[Solved] the preLaunchTask 'C/C++:gcc.exe build active file' terminated with exit code -1 (VS Code)
ฝัง
- เผยแพร่เมื่อ 13 ส.ค. 2023
- Solve 'The preLaunchTask 'C/C++:gcc.exe build active file' terminated with exit code -1' error in Visual Studio Code with our comprehensive guide. Learn about GCC, the integrated terminal, and tips for debugging C++ programs in VS Code.
Article: www.techrbun.com/solve-pre-la... - วิทยาศาสตร์และเทคโนโลยี
Is this issue rare? Why no one is making videos on how to solve this issue? I think we have to ask Visual studio code team directly to state how to fix this in there website
if anyone is still having this issue
1. From the "Edit Configurations (UI)" access the "c_cpp_properties.json" file and change the "compilerPath" to g++.exe instead of gcc.exe.
2. In the folder of your cpp file you'll find a ".vscode" folder. Open the file "tasks.json" inside it.
3. Change the "command" path to g++.exe instead of gcc.exe
what about mac?
it worked thank you so much bro
Thanks
Thank you so much man you are the actual goat
In my installation, in order to apply your solution, I found that I had to completely remove the lines
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "C:\\msys64\\ucrt64\\bin\\gcc.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
from tasks.json and only leave the corresponding ones with g++. That's how I got it to work.
I first tried placing the g++ ones above the ones with gcc, but that didn't work. So, I deleted the section on gcc entirely.
I hope I have done the right thing.
I had this problem and for me the cause was vscode tried compiling c++ file with gcc. gcc doesn't have access to standard c++ lib needed for std::cout, so my std::cout
This is actually a lifesaver!! Thanks for sharing this!!
it worked thanks!😭
thanks a lot
uwu thanks a lott, u saved my day
Thank you
there is no c/c++: edit configurations (ui)“ in command palette, i have followed all previous tasks as you said
make sure you use ctrl+shift+p to open the command palette and not just left click on it
I am not able run large programs .....The problem was resolved for small codes.....Please help
issue is still not solved, though i checked everything you mentioned.
There must be something wrong in your tasks.json file
My Problem got solved but next day again appeared
I have been using code runner extension to build and run the cpp file this extension conflicts with the cpp extension pack, so i have disabled it then issue solved..
have you finally solved it ?
thank you so much man.. this disabling technique works like a charm@@mazharulalam3885