VS Code will not build c++ programs with multiple .ccp source files
in tasks.json:
"label": "g++.exe build active file",
"args": [
"-g",
"${fileDirname}\\**.cpp",
//"${fileDirname}\\**.h",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
],
in launch.json:
"preLaunchTask": "g++.exe build active file"
it will work if your sources are in separated folder
VS Code build c++ programs with multiple .ccp source files
First make the a.out
file first and change the /.vscode/lauch.json
file. In that file change the "program": "whatever"
to "program": "${workspaceFolder}/a.out"
and if there is a "preLaunchTask": "C/C++: g++ build active file",
then cut that line then press F5 and the debugger should work fine.
Check out here for more clearification.
Related Topics
Embedding Resources in Executable Using Gcc
Forward Declaration of Nested Types/Classes in C++
What Happens When I Print an Uninitialized Variable in C++
Pure Virtual Destructor in C++
C++: Life Span of Temporary Arguments
Compilers and Argument Order of Evaluation in C++
How to Properly Delete Nodes of Linked List in C++
How to Have Functions Inside Functions in C++
Difference Between _Tmain() and Main() in C++
C++ Templates That Accept Only Certain Types
Catching Exception: Divide by Zero
How to Handle Wrong Data Type Input
What Exactly Is "Broken" With Microsoft Visual C++'S Two-Phase Template Instantiation
Why Should the Copy Constructor Accept Its Parameter by Reference in C++
Declaring Pointers; Asterisk on the Left or Right of the Space Between the Type and Name
Why Are Elementwise Additions Much Faster in Separate Loops Than in a Combined Loop