Closed pfuerste closed 3 years ago
You're using the CMake Tools configuration provider? Did you run CMake: Configure? Can you look at the output of running C/C++: Log Diagnostics and look for what includes paths are being sent by the configuration provider? This may be a CMake Tools bug (includePath won't get used if CMake Tools is used)
Thanks for your answer.
I did not configure at first, but did now, the error remains the same.
I had the CMake and CMake Tools extensions installed, but did not actually use them yet (my project structure is rather simple and I wanted to get into the extensions soon). Uninstalling them fixed the problem.
Edit: After a restart, the problem came back. I currently do NOT have the CMake (&Tools) Extensions installed in WSL, but I do get the error. The strange thing is, Intellisense (or at least I guess its Intellisense) does autocomplete the path while tying, but gives me red squiggles afterwards.
It also autocompletes from the imported libraries, such as cv::Vec3b, but still squiggles it.
I hope this is the right output for the Log diagnostics you asked for:
Can you run C/C++: Log Diagnostics from the View->Command Palette?
The logging you provided suggests that /vcpkg/installed/x64-linux/include is in your include path. Where is the catch2 folder located? You'll want to make sure that folder is in your include path. If you think that the "**" recursive includes is not finding the path when it should be, you can try running the C/C++: Reset IntelliSense Database command.
catch.hpp is in ~/vcpkg/installed/x64-linux/include/catch2 and ~/vcpkg/installed/x64-linux/include/** is currently in my include path, so it should find it, right? I did reset the Database, which did not help.
Here is the Log Diagnostics output:
-------- Diagnostics - 4/19/2021, 9:04:02 PM
Version: 1.3.0
Current Configuration:
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/home/philip/vcpkg/installed/x64-linux/",
"/home/philip/vcpkg/installed/x64-linux/**",
"/home/philip/vcpkg/installed/x64-linux/include",
"/home/philip/vcpkg/installed/x64-linux/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.cmake-tools",
"compilerArgs": [],
"intelliSenseModeIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"compilerPathIsExplicit": true,
"browse": {
"path": [
"${workspaceFolder}/**",
"/home/philip/vcpkg/installed/x64-linux/",
"/home/philip/vcpkg/installed/x64-linux/**",
"/home/philip/vcpkg/installed/x64-linux/include",
"/home/philip/vcpkg/installed/x64-linux/include/**"
],
"limitSymbolsToIncludedHeaders": true
}
}
Custom browse configuration:
{
"browsePath": [
"/home/philip/vcpkg/installed/x64-linux/include",
"/home/philip/projects/pixelator/source"
],
"standard": "c++17",
"compilerPath": "/bin/g++-9",
"compilerArgs": [
"-g"
]
}
Translation Unit Mappings:
[ /home/philip/projects/pixelator/source/clustering.cpp ]:
/home/philip/projects/pixelator/source/clustering.cpp
Translation Unit Configurations:
[ /home/philip/projects/pixelator/source/clustering.cpp ]:
Process ID: 445
Memory Usage: 102 MB
Compiler Path: /bin/g++-9
Includes:
/usr/include/c++/9
/usr/include/x86_64-linux-gnu/c++/9
/usr/include/c++/9/backward
/usr/lib/gcc/x86_64-linux-gnu/9/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
Standard Version: c++17
IntelliSense Mode: linux-gcc-x64
Other Flags:
--g++
--gnu_version=90300
Total Memory Usage: 102 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 2747
You have configurationProvider set, which will cause includePath to not be used. Can you remove that?
Yeah, that fixed it. I don't know why it was set though (or what it is), will this impact other functionality?
There are some code paths that may auto-set that or in response to a prompt button if we detect that you have CMake Tools installed and have a CMakeLists.txt. If you're using a CMake project, it usually recommended to be configured via the CMake Tools configuration provider, but if your project is simple enough you can configure it via c_cpp_properties.json as well. It shouldn't affect anything except how IntelliSense is getting its configuration information.
I am pretty new to CMake and just installed some packages via vcpkg. Am I missing something? I used vcpkg to install some package for my project, but intellisense tells me it cant open the source file:
This are the 3 items in my includepath:
${workspaceFolder}/** ~/vcpkg/installed/x64-linux/ ~/vcpkg/installed/x64-linux/**
CMake does find the files of the installed packages after
set(CMAKE_PREFIX_PATH "~/vcpkg/installed/x64-linux/")
and is able to compile.