jupyter-cpp-kernel
jupyter-cpp-kernel copied to clipboard
Change C++ std to whatever gcc supports
Discussed in https://github.com/shiroinekotfs/jupyter-cpp-kernel/discussions/27
Originally posted by ShashaankHari February 7, 2024 I use jupyter on browser and vscode, primarily on vscode,. How do i change the C++ standard so that it is easier to change standard of code. i check the kernel.py
114 self.standard = "c++14" # default standard if none is specified
121 subprocess.call(['g++', filepath, '-std=c++14', '-Wno-unused-but-set-variable', '-Wno-unused-parameter', '-Wno-unused-variable', '-ldl', '-w', '-o', self.master_path])
163 cflags = ['-pedantic', '-fPIC', '-std=c++14', '-w', '-shared', '-Wno-unused-but-set-variable', '-Wno-unused-parameter', '-Wno-unused-variable'] + cflags
What can I do to change the standard per nootbook basis, because if it uses native gcc then it sure can support newer versions too right?
And in that case we can use the same kernel for running C programs
using fstrings f'std={self.standard}'
in all the places is one suggestion.
How do i pass the std for the particular nootbook on vscode/browser?
I see your question covered quite a lot of questions about my kernel, so I will answer them separately.
How do i change the C++ standard so that it is easier to change standard of code. i check the kernel.py
The current C++ kernel - version 1.0.0a7, uses the C++ 14 standard. The plan for other C++ standards only happens in the future, when the kernel reaches its stable state, not alpha or beta state.
If you ask about adding compile flags for your code, you can try //%cflags:
. Add it before any C++ code you wanna run
//%cflags: <your flag>
What can I do to change the standard per nootbook basis, because if it uses native gcc then it sure can support newer versions too right?
I don't get your question. If you're asking about the support of the g++
process, it's your installed g++
in your machine. And surely, you can uninstall, download the newer/older one, or even compile from the source and then install it.
The reason I have made a short description is "C++ kernel for Jupyter. Easily adopt and deploy for testing environment." is because of the different organizations and people with different gcc/g++
environments, and they want to test which is the test setup, by running samples on our C++ kernel.
And in that case we can use the same kernel for running C programs
using fstrings f'std={self.standard}' in all the places is one suggestion.
Well, yes. I had thought that way, but as I mentioned earlier, it should be an option only when the kernel is ready to be in production. You have to wait, but not too long.
How do i pass the std for the particular nootbook on vscode/browser?
At least you cannot because of the restriction I have made to the application. If you find a way to break that wall, feel free to share it with us. I am always happy to hear how and what kind of other developers do on my software.
By the way, thanks for your comments, suggestions, and your concentration on my source code. Honestly, I am having problems when finding a new wind with my kernel.