In a C++ project, I have a folder such as
/projectFolder
|
|->executables
|
|->src
I have some .cpp files with main function under executables folder. These files include some header files under src folder. Under src folder, there are subfolders and all header files should be included to files under executables.
I tried to adjust my tasks.json as this
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "C:\\msys64\\mingw64\\bin\\g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-I",
"{absolute path to src folder}\\src"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
However, when I run the cpp under executable directory, it still gives warning that header files cannot be found. I also suspect that it cannot compile the cpp files under src directory as well. How can I fix this?