Cpp Compile-Time Error
mrPuckk opened this issue · 2 comments
Hi there, I got an issue when using std::vector
in Cpp with Sniprun. (g++ compiler)
Describe the bug
I am encountering a compile-time error when using vectors declared in C++. The compiler I am using is g++ that set in Sniprun setup.
To Reproduce
I'm experiencing a compile-time error only when using Sniprun with code snippets that involve vectors having predefined elements. However, if the vector is declared in the same format without initializing its elements, the code runs smoothly.
std::vector<int> myVector{ 5, 10, 15 }; //Got Compile-time Error
std::vector<int> A; //Run smoothly
Or even I tried a case: std::vector<int> A(5, 10);
, it still runs smoothly.
Environment:
- LunarVim
- Macos
Hi,
I configured my sniprun instance to run g++ but haven't encountered the issue you mention...
std::vector<int> v {8,4,5,9};
don't fail with 'Compile-time error', and neither do variants (with v = {...}, v; with/without spaces).
Does your code snippet compiles fine outside of sniprun ? I have a fairly recent g++ version, so it may be due to that ..?
In any case, you can check sniprun's log at $XDG_CACHE/sniprun/sniprun.log (often ~/Library/Caches on MacOS I believe), with that huge pile of crap text, you should be able to confirm whether you're using g++ as you think you are, and run g++ directly on the generated file ($XDG_CACHE/sniprun/c_original/main.cpp) to see what's the error
Closing, assuming your problem doesn't bother you anymore