Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having multiple using namespace statements in one Jupyter cell doesn't work properly #485

Open
ianholst opened this issue Jan 29, 2023 · 1 comment
Labels

Comments

@ianholst
Copy link

To Reproduce

I'm using the Jupyter kernel included in Cling, not xeus-cling. For example, run in the first cell:

#include <iostream>
#include <chrono>

using namespace std;
using namespace std::chrono;

Then in the second cell, I access something from the second namespace, std::chrono:

system_clock c;

I would expect this to successfully declare the variable and give no output, but instead Cling gives an error indicating that the std::chrono namespace has not been made available:

input_line_4:2:2: error: unknown type name 'system_clock'; did you mean 'std::chrono::system_clock'?
 system_clock c;
 ^~~~~~~~~~~~
 std::chrono::system_clock
/usr/include/c++/11/chrono:1125:12: note: 'std::chrono::system_clock' declared here
    struct system_clock
           ^
ename: evalue

This same code works fine in the Cling command line interpreter, where things are not split up into cells.

I know that the first using namespace worked, since I can use just cout << "test"; with no problem in later cells. Doing more tests (with code other than the C++ standard library), it looks like only the first using namespace is processed correctly by Cling, and all later ones in the same cell are ignored.

Setup

  1. Cling version 0.9
  2. Operating system: Ubuntu 22.04
  3. I built Cling myself from source.
@ianholst ianholst added the bug label Jan 29, 2023
@ianholst
Copy link
Author

I've confirmed that this is also an issue for the xeus-cling kernel. Here is a screenshot:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant