-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IntelliSense picks up wrong include path and shows false-positive error squiggles #3781
Comments
@gcampbell-msft I think the user this problem is because, #include this header file is introduced in c++20 standard, but visual studio2017 doesn't support C++20 standard, so that's why this problem is occurring, even if you add target_compile_features in CMakeLists file ( main PUBLIC cxx_std_20) in the CMakeLists file, it should not make the compiler to support C++20, I don't know if I understand correctly, can you give me some suggestions? |
@v-frankwang, not quite. I have vs2022 installed, and cmake uses vs2022 generator and configure/build runs successfully. The problem is that the IntelliSense in vscode searches for headers in vs2017 include dir for some unknown reason, and shows false-positive error squiggles. |
@gcampbell-msft @kokostek The user's problem is that cmake uses the vs2022 generator, but IntelliSense in vscode searches for header files in the vs2017 include directory. I reproduced the issue raised by the user and here are the steps to reproduce this issue Repro steps:
} Actual result: |
@kokostek Looks like this is most likely a bug in cpptools: microsoft/vscode-cpptools#12293 |
@jophippe Thanks for the update! Yes, seems like it is fixed now with pre-release cpptools. Though I had to delete cache and reconfigure to make error squiggles go away. |
Brief Issue Summary
I have two Visual Studios installed on my PC: 2017 and 2022. CMake project build targets VS2022 by specifying
"generator": "Visual Studio 17 2022"
inCMakePresets.json
.IntelliSense reports errors when I try to include some standard header, which is available in VS2022, but not available in VS2017, like
<ranges>
for example:In the mean time, project configures and builds just fine.
When I try to navigate to included file which is not highlighted by IntelliSense (i.e.
<cstdio>
), I end up in the VS2017 include directory, which is also not ok:Project contents:
CMakeLists.txt
:CMakePresets.json
:main.cpp
:CMake Tools Diagnostics
Debug Log
Additional Information
No response
The text was updated successfully, but these errors were encountered: