C++ build fail - Header files in include path not found - c_cpp_properties.json settings invoking compiler? #7047
-
Hi, The reason that I am asking this question here again is that I read the description and the tutorial on the vscode website differently to the answer I received on stackoverflow, so I would like to have it confirmed that I am wrong (or perhaps right). I've always believed that my c_cpp_properties.json file can change the arguments when invoking my compiler. So if I want to have a particular include path, I put it into my c_cpp_properties.json file which then gives the information further to my tasks.json where to look for the header file. Am I correct or wrong in my understanding? To my actual problem: Following the guideline on how to setup mingw g++ in vscode, I cannot seem to succeed in including headerfiles from a subdirectory. I have my working folder, in which my main.cpp lies. In that working folder, I have a subfolder called "inc" in which my header file add.h lies, and I have a subfolder "src" in which my add.cpp file lies. When I pass the argument to the compiler to include header files using the -I argument, it works fine. But this kind of contradicts the tutorial found on the vscode website that states that I should add include paths in the c_cpp_properties.json file: The build output message:
A simple minimalistic code:
A screenshot of my project to illustrate my inc and src folder: My tasks.json:
My c_cpp_properties.json:
Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
tasks.json and c_cpp_properties.json are separate with no interaction between them, so both need to be configured separately (usually in the "equivalent" way). |
Beta Was this translation helpful? Give feedback.
tasks.json and c_cpp_properties.json are separate with no interaction between them, so both need to be configured separately (usually in the "equivalent" way).