How to add an include path to a vscode project? #10088
-
Asking this here because I can't seem to find an answer anywhere else. Really trying to give this IDE a shot, but this is a pretty basic example and it is going nowhere. I need to see a working example of how to add an include path to vscode. My directory structure: C:. funcs.h:
funcs.cpp:
main.cpp:
VSCode marks red squigglies under the #include "funcs.h" in main.cpp, but not in funcs.cpp for some reason. VSCode says it cannot find funcs.h. If I try to build the compiler throws the same error. I have tried adding an include path for the inc folder by editing the C/C++ Configuration page and in the c_cpp_properties.json file. By default it already contains ${workspaceFolder}/** which is supposed to search recursively through all the directories. All of the googling I have tried says to add the path here but never gives the exact syntax. I have tried adding: How do I make vscode see my .h file in my inc folder? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 17 replies
-
Can you run the |
Beta Was this translation helpful? Give feedback.
-
I added it to the tasks.json And the program started acting really strange. Mouseclicks are not being registered. Only one file can be open in the editor now, if I try to open a new one it closes the current one/tab and opens the new one in its place. |
Beta Was this translation helpful? Give feedback.
I added it to the tasks.json
The red squiggles are gone from main.cpp
It still fails, but now for a slightly different error:
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\PEL6FH\AppData\Local\Temp\ccrYS7OC.o:C:/Users/PEL6FH/Desktop/temp/MSVSC_hell/src/main.cpp:5: undefined reference to `sayHello()'
collect2.exe: error: ld returned 1 exit status
And the program started acting really strange. Mouseclicks are not being registered. Only one file can be open in the editor now, if I try to open a new one it closes the current one/tab and opens the new one in its place.