Vscode-cpptools: Unable to find header files

Created on 29 May 2018  Â·  13Comments  Â·  Source: microsoft/vscode-cpptools

Mac OS Sierra 10.12.16
VS Code 1.23.1
C/C++ 0.16

Config File

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "/Library/Developer/CommandLineTools/usr/include/c++/v1",
                "/usr/local/include",
                "/Library/Developer/CommandLineTools/usr/lib/clang/9.0.0/include",
                "/Library/Developer/CommandLineTools/usr/include",
                "/usr/include",
                "/usr/local/Cellar/eigen/3.3.4/include/eigen3/",
                "/usr/local/Cellar/pcl/1.8.1_2/include/pcl-1.8/",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/Library/Developer/CommandLineTools/usr/include/c++/v1",
                    "/usr/local/include",
                    "/Library/Developer/CommandLineTools/usr/lib/clang/9.0.0/include",
                    "/Library/Developer/CommandLineTools/usr/include",
                    "/usr/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

IntelliSense is unable to find pcl/Eigen headers even though those exist in the paths mentioned above in the config file. Is this a known bug or potential solutions exist?

Language Service question

Most helpful comment

If it's in your root workspace, you need to use #include "" instead of #include <>, because the <> version doesn't add the current directory to the include path. Otherwise, you need to modify your task.json to specify the correct include path for g++. c_cpp_properties.json isn't used by g++.exe.

All 13 comments

Are you referring to auto-complete for #include? If you want the pcl/eigen headers to show up, you need to add those paths to the "browse.path"

No autocompletion works fine and when I right click on the header it would take me to the definition as well, but it would fail to compile. Compile error being unable to find the header file.

Our extension doesn't compile files. Do you have a tasks.json that you're using or are you using another extension to provide build services?

Sorry to reopen an old thread. I'm having a similar issue. Intellisense has no problem finding the header file, I can right click on #include <header.hpp> and be taken to the header definition. header.h is in the base workspace directory (the same as .vscode and main.cpp).

However, I'm getting an error when I try to build. I get fatal error: header.hpp: No such file or directory

My c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "${workspaceFolder}"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++11",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}

My tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build crc",
            "type": "shell",
            "command": "g++",
            "args": [
                "-g",
                "bitset_crc.cpp"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": []
        }
    ]
}

If it's in your root workspace, you need to use #include "" instead of #include <>, because the <> version doesn't add the current directory to the include path. Otherwise, you need to modify your task.json to specify the correct include path for g++. c_cpp_properties.json isn't used by g++.exe.

same problem, it didn't work

@ES5017 I don't know what "same problem" means. What didn't work? Can you open a new issue?

Here is a picture of it.
Same problem on my mac osx.
It is an arduino project - correctly compiles on Windows Visual Studio Community edition with vmicro.
No such luck on the mac

vscode_include

Here is the complete verify output.
EQG2HBX.verify.txt

@ozarchie our extension doesn't provide any build services right now, so perhaps yours is an issue with the Arduino extension?

Hi Bob,
Wow .. so an extension can stop a c-construct as old as #include working.
I guess I will just go back to plain vanilla arduino.
Cheers

On Sat, Mar 2, 2019 at 6:47 AM Bob Brown notifications@github.com wrote:

@ozarchie https://github.com/ozarchie our extension doesn't provide any
build services right now, so perhaps this is an issue with the Arduino
extension?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/vscode-cpptools/issues/2052#issuecomment-468806288,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGLdJ30jDWaSfn6toRODsYQHciN7Bxygks5vSZHzgaJpZM4UQuVh
.

@ozarchie, I don't think you understood my comment. The build task and error you are referring to doesn't come from the C/C++ extension. This extension only does IntelliSense right now. We don't compile anything. There is a separate extension for Arduino that you probably installed that is doing your compilation. I'm just saying that you should open an issue on that extension.

Closing this issue due to long inactivity.

Was this page helpful?
0 / 5 - 0 ratings