-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
the prelaunchtask c/c++: gcc build active file terminated with exit code -1 #11927
Comments
@browntarik sorry for the late reply. |
It looks like there is an issue because of the '&' character in your path. Could you try renaming your directory to remove it and try the executable again? If you would like to keep the ampersand you may have to escape it in the file path, but it is generally not recommended practice to use special characters in file paths. |
@browntarik so it worked when I indeed changed the ampersand character, I have another question when I use the the GCC from the dropdown it doesn't work, that's on a different directory but the g++ works as intended, does that have to do with Linux? |
Based on the error you showed me (i.e undefined reference to std::cout) I would guess that you are trying to use the gcc compiler to build a c++ project, please try using the g++ compiler instead. |
The g++ compiler works just fine. |
Yes, that is generally the case. You could use explicit linking if you have a specific reason to use gcc. To use explicit linking just add the -lstdc++ to your list of arguments though it is recommended you just use g++. |
Awesome thanks for taking the time to solve the problem and answer my questions. |
I am glad I was able to help, I will now close this issue but it will be available for future reference. |
Could you please help? |
@dheerajparashar Hey there, it seems that in your case it's giving permission denied, I would have 2 solutions that I would try first.
The easiest is to change the project's location as it can be tedious to change the permission of the folder especially since it's in the C: folder and I haven't been having that much luck with permissions on Windows. |
Thanks mate I will try this and let you know what happens. |
Type: Bug
Expected result: compile the file and run it.
Not sure if it has to do with the flags, but apparently on linux it doesn't work, I tried another extension which used these flags and it worked like a charm ["-g3", "-Wall", "-Wextra", "${file}", "-o", ""${fileDirname}/${fileBasenameNoExtension}""]
Here is an e.g. from the extension that worked "Executing task: g++ -Wall -Wextra -g3 /run/media/yamo/EDU/Extracurriculars/OSC/S&T/DS/wordOnThePaper.cpp -o /run/media/yamo/EDU/Extracurriculars/OSC/S&T/DS/output/wordOnThePaper
"
Extension name: C/C++ Compile Run
Extension version: 1.18.5
VS Code version: Code 1.86.0 (05047486b6df5eb8d44b2ecd70ea3bdf775fd937, 2024-01-31T10:27:46.147Z)
OS version: Linux x64 6.6.10-1-MANJARO
Modes:
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
A/B Experiments
The text was updated successfully, but these errors were encountered: