Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 98612

Adding include paths for C++ project in Visual Studio Code

$
0
0

I just started using Visual Studio Code with C/C++ extensions and I want to include non-system header C:/Libraries/sq.h located outside of my project directory. I added its path to c_cpp_properties.json file so Intellisense can find the header:

"configurations": [
    {
        "name": "Win32",
        "includePath": [
            "${workspaceFolder}/**",
            "${vcpkgRoot}/x64-windows/include",
            "C:/Libraries"
        ],
        "defines": [
            "_DEBUG",
            "UNICODE",
            "_UNICODE"
        ],
        "windowsSdkVersion": "10.0.18362.0",
        "compilerPath": "C:/Programs/MinGW/bin/g++.exe",
        "cStandard": "c11",
        "cppStandard": "c++17",
        "intelliSenseMode": "gcc-x64"
    }
],

Unfortunately, the build task configuration is not aware of C:/Libraries path, so I had to add it to tasks.json too:

      "args": ["-I", "C:/Libraries", "-g0", "-o", "hellovscode", "main.cpp"],

Is there any way to avoid duplicating the include paths? Are there tools, which can generate and maintain these configuration files?


Viewing all articles
Browse latest Browse all 98612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>