Closed jbuckAI closed 5 years ago
Did some more searching in the Issues and found 2192. Looks similar to my issue, however how can you exclude whole folders?
Issue 1976 is similar as well. However, I have
"C_Cpp.default.compilerPath": "C:/Program Files (x86)/IAR Systems/Embedded Workbench 8.1/arm/bin/iccarm.exe",
in my settings.json file. This doesn't seem to resolve my issue.
It looks like the extension not able to handle the output from the compiler and then falling back to clang?
The trouble is that your compiler isn't queryable in the same way that GCC-related compilers are, so the extension is unable to determine your system include path. Instead, the extension is finding cl.exe and using the system includes from your Visual Studio/Windows SDK installation instead.
Does your compiler support querying the system includes path and defines?
Unfortunately, I don't think so. I have sent a question to IAR for help. If there was a way to query, can I force the extension to use arguments and take in paths it suggests? I could create a wrapper .exe and fake the output to be more like gcc.
Otherwise, is there any way to prevent the indexing of those paths (other than removing them)?
If you set "compilerPath": ""
, the extension will not try to guess system include paths. You can then add the relevant system include paths to "includePath"
.
If you set "compilerPath": "", the extension will not try to guess system include paths. You can then add the relevant system include paths to "includePath".
Woot! Leaving "compilerPath" empty did the trick! It seems Go To Definition is now going to the correct file and the index paths from the Debug output are only indexing stuff from my "includePath".
I'm good now, thank you for the help! Was/is/should there be to documentation about what might be automatically included and how to prevent adding paths with the blank "compilerPath"? That might help me and others in the future. Thanks again!
Yes, there should be documentation on this, but there wasn't. I updated: https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/c_cpp_properties.json.md
@jbuckAI @bobbrow
I have the similar issue, I already set the "compilerPath": "" , but Go To Definition still finds 5 definitions, the last one in IAR complier directory is what I need, but the others header files are located in cygwin64 folder. How to exclude cygwin64 folder?
"configurations": [
{
"name": "IAR",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/../Config/exec/arm/inc/c",
"${workspaceFolder}/../Config/exec/arm/inc/cpp"
],
"defines": [
"CPU_S32K146",
"__ICCARM__"
],
"compilerPath": "",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
The extension should be removing those paths after you set the compilerPath
to "". If you run the "Reset IntelliSense Database" command, does it fix the problem? If not, can you please open a new issue for this?
The extension should be removing those paths after you set the
compilerPath
to "". If you run the "Reset IntelliSense Database" command, does it fix the problem? If not, can you please open a new issue for this?
"Reset IntelliSense Database" command can fix the problem, thank you for the help.
Background I am using VSCode with the C/C++ extension to edit ARM mbedOS files. The compiler am I using to build is from IAR.
Issue The extension is doing a pretty good job of finding the definitions of objects but occasionally it will jump to a definition found in C:\PROGRAM FILES (X86)\WINDOWS KITS. How do I prevent the extension from indexing folders like C:/PROGRAM FILES (X86)/WINDOWS KITS/ and C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/?
Expected behavior With the settings I have in my .json files only C/CPP/H files that should only be indexed should be from the workspace sub-directories and IAR's compiler sub-directories. I would expect to either not find the correct definition or find nothing at all (which would mean the include path is not be indexed properly).
Versioning info:
c_cpp_properties.json
Debug output
Please let me know how I can help you help me!