Reputation: 563
I have a complex directory structure for a C project in which CMAKE governs which files are used for a certain project.
I tried using CMake extensions for VS Code, but it did not work very well.
Is there a way to tell VS Code which files exactly are used to be able to navigate through the code?
Upvotes: 8
Views: 20483
Reputation: 378
Open the Command Palette (F1 or Ctrl+Shift+P), look for "C/C++: Edit configurations (UI)", and add the desired folders under "Include path". This will allow Visual Studio Code's IntelliSense to know where your header files are located.
For an optimized experience, don't forget to also set up the path to the compiler, the IntelliSense mode appropriate for that compiler, and the C/C++ standards you are using.
PS: For more on how to use VS Code for C and C++ programming, you may be interested in these lecture notes I wrote for a graduate course I'm teaching.
Upvotes: 14