'Is Visual Studio Code able to have multiple includePath for different OS in .vscode/c_cpp_properties.json?

I am working on my project on multiple operating systems, including Windows, WSL Ubuntu and Mac, using VSC. My includePath in .vscode/c_cpp_properties.json is based on the settings in my Mac. However, when I work on other OS's, header files in such OS's have different locations from Mac.

Is there any way to solve this problem, excluding using other IDE's?



Solution 1:[1]

Yes, you can specify a platform-dependent configuration by adding "name": <your_platform> to your c_cpp_properties.json file, like this:

"configurations": [
    {
      "name": "Mac",
      "intelliSenseMode": "clang-x64",
      "includePath": ["${myDefaultIncludePath}", "/another/path"],
      ...
    }
  ],

In principle, you can use any name that identifies your configuration, but Linux, Mac, and Win32 are special identifiers for configurations that will be automatically selected on those platforms (see: official guide).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dushoda