Can't find include file when have set c_cpp_properties.json
System : OSX 10.12.3 vscode version: 1.11.1 clang adapter version: 0.2.2
Clang command adapter can't find the file included and path has been added in c_cpp_properties.json
the configuration is
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"/Library/Developer/CommandLineTools/usr/include/c++/v1",
"${workspaceRoot}/src"
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Linux",
"includePath": [
"/usr/include",
"/usr/local/include"
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*"
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
]
And it gives the error
file: 'file:///Users/suemi/Workspace/SimpleRpc/src/rpc/net/rpc_message_handler.cc'
severity: '错误'
message: ''rpc/net/rpc_message_handler.h' file not found'
at: '5,10'
source: ''
I am also seeing an issue in the latest vs code. The autocomplete for header file is not working. Not sure if this is related.
When I type #include <v>, what I expect it would give some header file suggestions like vector. It used to be working. Don't why it suddenly is not working
i'm also seeing the same issue. When including a header inside a header file (eg. #include <stdio.h>), I get a red squiggle with "file not found"
The combination of MS cpptools 0.11.0 and cmake tools on Linux doesn't work so well either: the configuration button (lower right) disappears. I guess that's OK since the configuration choice is up to cmake. But, it turns out that cpptools now looks for include files under the Mac section of c_cpp_properties.js --- even as Cmake declares
The system is: Linux - 4.4.0-72-generic - x86_64
Try add clang configuration in settings.json. The settings looks like:
"clang.cflags": ["-fsyntax-only", "-Ix:/xxx/include1", "-Ix:/xxx/include2"]
Note there shouldn't be any white space between -I and your include path, or the extension would throw include file not found error.
Are we supposed to set the include paths trough clang.cflags, trough the c_cpp_properties.json, or both?
@abmantis Why do you want to use both extension at the same time? clang extension already provides auto-completion and diagnostic. Setting clang flags and disable M$ c/c++ extension and you'll be fine.
I just discovered I was having issues with this extension (I thought it was another one, vscode-cpptools), where my includes are being indicated as File not found, even if they existed: https://github.com/Microsoft/vscode-cpptools/issues/2521
A simple bugged scenario is here: https://github.com/Microsoft/vscode-cpptools/issues/2521#issuecomment-488548487 I can reproduce it later if someone is interested in diagnosing the causes of the issue, but it is exactly the same reproduced here... I'll try to test the indicated flags.