Note that I\'m using VS Code on Ubuntu 17.10 and using the GCC Compiler.
I\'m having trouble building a simple program which makes use of additional .ccp files. I\'m
This is a windows answer for the same problem:
I was struggling with this as well until I found the following answer at https://code.visualstudio.com/docs/cpp/config-mingw :
You can modify your tasks.json to build multiple C++ files by using an argument like
"${workspaceFolder}\\*.cpp"
instead of${file}
. This will build all .cpp files in >your current folder. You can also modify the output filename by replacing "${fileDirname}\\${fileBasenameNoExtension}.exe
" with a hard-coded filename (for >example "${workspaceFolder}\\myProgram.exe")
.
Note that the F in workspaceFolder is capitalized.
As an example, in my tasks.json file in my project, the text in between the brackets under "args" originally appeared as follows:
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
This gave me reference errors because it was only compiling one and not both of my files.
However, I was able to get the program to work after changing that text to the following:
"-g",
"${workspaceFolder}\\*.cpp",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"