I'm currently using https://marketplace.visualstudio.com/items?itemName=mitaki28.vscode-clang which is great as a nice little tool for accessing member functions.
I am however having one issue with a project I am importing. While the above clang feature works, I am having particular problem with using include directories. My project structure is as follows:
|- src/
|- main.cpp
|- include/
|- MyHelper.h
|- CMakeLists.txt
Is there a way to configure my include directories in Visual Studio Code such that in main.cpp
I can just do:
#include "MyHelper.h"
instead of #include "include/MyHelper.h"?
In the editor, it highlights my include statement saying it's unable to find the file. While the editor is not a big deal (my project compiles), the subsequent issue is the vscode-clang plugin does not work because it does not see the file.
Perhaps even have it use the config from my CMakeLists.txt in the editor for necessary includes?
Thanks!
Okay, this was foolish, but in the event someone uses Visual Studio Code
and does not have a trivial project. These instructions are assuming you're using clang compiler:
.vscode/settings.json
Configure the line below inside of the JSON object:
// Compiler options for C++ (e.g. ['-std=c++11'])
"clang.cxxflags": [
"-I/path/to/my/include/directory" // header files
],