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

Leave a Comment