Vscode-cpptools: std::cout and other std types can not be recognized when using Clang on Windows

Created on 10 May 2020  Â·  9Comments  Â·  Source: microsoft/vscode-cpptools

Type: LanguageService
Describe the bug

  • OS and Version: Windows 10 1909
  • VS Code Version: 1.45.0
  • C/C++ Extension Version: 0.28.0
  • Other extensions you installed (and if the issue persists after disabling them): CMake, CMake Tools. Issue solved after disable CMake Tools.
  • Does this issue involve using SSH remote to run the extension on a remote machine?: No
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

Here I am doing some CUDA involved project and use CMake, CMake Tools extension to help.
I am also using 'Clang 10.0.0 for MSVC ...' Tool chains scanned by CMake Tools.
A lot of non-existed errors came out like: 'namespace "std" has no member "cout"'.
Still the project can be built successfully.
If I change the tool chain to 'Visual Studio Community 2019 ...' and restart, errors will disappear.

Steps to reproduce
Here is a simple CMake CUDA project which can trigger this 'namespace "std" has no member "cout"' problem.
https://github.com/gzfrozen/ptx_test

Expected behavior
No error should happen.



Logs


Logs from the command C/C++: Log Diagnostics
-------- Diagnostics - 5/11/2020, 1:47:15 AM
Version: 0.28.0-insiders3
Current Configuration:
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17763.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64",
"compilerArgs": [],
"configurationProvider": "vector-of-bool.cmake-tools",
"browse": {
"path": [
"${workspaceFolder}/
"
],
"limitSymbolsToIncludedHeaders": true
}
}
Translation Unit Mappings:
Translation Unit Configurations:
Memory Usage: 52 MB
Compiler Path: C:/Program Files/LLVM/bin/clang-cl.exe
Includes:
C:\USERS\GZFRO\SOURCE\REPOS\PTX_TEST\BUILD
C:\PROGRAM FILES\LLVM\LIB\CLANG\10.0.0\INCLUDE
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\VC\TOOLS\MSVC\14.25.28610\INCLUDE
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\VC\TOOLS\MSVC\14.25.28610\ATLMFC\INCLUDE
C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\UCRT
C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\SHARED
C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\UM
C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\WINRT
Defines:
WIN32
_WINDOWS
Standard Version: ms_c++latest
IntelliSense Mode: msvc-x64
Total Memory Usage: 52 MB

Logs from [the language server]:
Custom browse configuration received: {
"browsePath": [
"c:/users/gzfro/source/repos/ptx_test",
"C:/Users/gzfro/source/repos/ptx_test/build",
"c:/users/gzfro/source/repos/ptx_test/build"
],
"standard": "c++17",
"compilerPath": "C:/Program Files/LLVM/bin/clang-cl.exe",
"compilerArgs": [
"/DWIN32",
"/D_WINDOWS",
"/GR",
"/EHsc",
"/Zi",
"/Ob0",
"/Od",
"/RTC1"
]
}
cpptools/didChangeCppProperties
Attempting to get defaults from compiler found on the machine: 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe'
Code browsing service initialized
Attempting to get defaults from compiler found on the machine: 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe'
Folder: C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/COMMUNITY/VC/TOOLS/MSVC/14.25.28610/INCLUDE/* will be indexed
Folder: C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/COMMUNITY/VC/TOOLS/MSVC/14.25.28610/ATLMFC/INCLUDE/* will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/UM/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/UCRT/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/SHARED/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/WINRT/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/CPPWINRT/ will be indexed
Folder: C:/USERS/GZFRO/SOURCE/REPOS/PTX_TEST/ will be indexed
cpptools/didChangeCustomBrowseConfiguration
Attempting to get defaults from compiler in "compilerPath" property: 'C:/Program Files/LLVM/bin/clang-cl.exe'
Folder: C:/PROGRAM FILES/LLVM/LIB/CLANG/10.0.0/INCLUDE/ will be indexed
Folder: C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/COMMUNITY/VC/TOOLS/MSVC/14.25.28610/INCLUDE/ will be indexed
Folder: C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/COMMUNITY/VC/TOOLS/MSVC/14.25.28610/ATLMFC/INCLUDE/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/UCRT/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/SHARED/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/UM/ will be indexed
Folder: C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/WINRT/ will be indexed
Folder: C:/USERS/GZFRO/SOURCE/REPOS/PTX_TEST/ will be indexed
cpptools/clearCustomConfigurations
Populate include completion cache.
Discovering files...
Processing folder (recursive): C:/PROGRAM FILES/LLVM/LIB/CLANG/10.0.0/INCLUDE/
Processing folder (recursive): C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/COMMUNITY/VC/TOOLS/MSVC/14.25.28610/INCLUDE/
Processing folder (recursive): C:/PROGRAM FILES (X86)/MICROSOFT VISUAL STUDIO/2019/COMMUNITY/VC/TOOLS/MSVC/14.25.28610/ATLMFC/INCLUDE/
Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/UCRT/
Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/SHARED/
Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/UM/
Processing folder (recursive): C:/PROGRAM FILES (X86)/WINDOWS KITS/10/INCLUDE/10.0.17763.0/WINRT/
Processing folder (recursive): C:/USERS/GZFRO/SOURCE/REPOS/PTX_TEST/
Discovering files: 3868 file(s) processed
1 file(s) removed from database
Done discovering files.
Parsing remaining files...
Parsing: 0 files(s) processed
Done parsing remaining files.
Custom configuration provider 'CMake Tools' registered
Custom browse configuration received: {
"browsePath": [
"c:/users/gzfro/source/repos/ptx_test",
"C:/Users/gzfro/source/repos/ptx_test/build",
"c:/users/gzfro/source/repos/ptx_test/build"
],
"standard": "c++17",
"compilerPath": "C:/Program Files/LLVM/bin/clang-cl.exe",
"compilerArgs": [
"/DWIN32",
"/D_WINDOWS",
"/GR",
"/EHsc",
"/Zi",
"/Ob0",
"/Od",
"/RTC1"
]
}
cpptools/pauseParsing
cpptools/clearCustomConfigurations
cpptools/didChangeCustomBrowseConfiguration
cpptools/resumeParsing
Custom browse configuration received: {
"browsePath": [
"c:/users/gzfro/source/repos/ptx_test",
"C:/Users/gzfro/source/repos/ptx_test/build",
"c:/users/gzfro/source/repos/ptx_test/build"
],
"standard": "c++17",
"compilerPath": "C:/Program Files/LLVM/bin/clang-cl.exe",
"compilerArgs": [
"/DWIN32",
"/D_WINDOWS",
"/GR",
"/EHsc",
"/Zi",
"/Ob0",
"/Od",
"/RTC1"
]
}
cpptools/clearCustomConfigurations
cpptools/didChangeCustomBrowseConfiguration
cpptools/resumeParsing
Database safe to open
cpptools/queryTranslationUnitSource: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp (id: 2)
Custom configurations received:
uri: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp
config: {
"defines": [
"WIN32",
"_WINDOWS"
],
"standard": "c++17",
"includePath": [
"C:/Users/gzfro/source/repos/ptx_test/build"
],
"intelliSenseMode": "clang-x64",
"compilerPath": "C:/Program Files/LLVM/bin/clang-cl.exe",
"compilerArgs": [
"/DWIN32",
"/D_WINDOWS",
"/GR",
"/EHsc",
"/Zi",
"/Ob0",
"/Od",
"/RTC1"
]
}
cpptools/didChangeCustomConfiguration
Attempting to get defaults from compiler in "compilerPath" property: 'C:/Program Files/LLVM/bin/clang-cl.exe'
textDocument/didOpen: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp
cpptools/activeDocumentChange: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp (id: 3)
cpptools/getDocumentSymbols
cpptools/textEditorSelectionChange
cpptools/getFoldingRanges: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp (id: 4)
sending compilation args for C:\USERS\GZFRO\SOURCE\REPOS\PTX_TEST\MAIN.CPP
include: C:\USERS\GZFRO\SOURCE\REPOS\PTX_TEST\BUILD
include: C:\PROGRAM FILES\LLVM\LIB\CLANG\10.0.0\INCLUDE
include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\VC\TOOLS\MSVC\14.25.28610\INCLUDE
include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\VC\TOOLS\MSVC\14.25.28610\ATLMFC\INCLUDE
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\UCRT
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\SHARED
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\UM
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.17763.0\WINRT
define: __llvm__=1
define: __clang__=1
define: __clang_major__=10
define: __clang_minor__=0
define: __clang_patchlevel__=0
define: __clang_version__="10.0.0 "
define: __ATOMIC_RELAXED=0
define: __ATOMIC_CONSUME=1
define: __ATOMIC_ACQUIRE=2
define: __ATOMIC_RELEASE=3
define: __ATOMIC_ACQ_REL=4
define: __ATOMIC_SEQ_CST=5
define: __OPENCL_MEMORY_SCOPE_WORK_ITEM=0
define: __OPENCL_MEMORY_SCOPE_WORK_GROUP=1
define: __OPENCL_MEMORY_SCOPE_DEVICE=2
define: __OPENCL_MEMORY_SCOPE_ALL_SVM_DEVICES=3
define: __OPENCL_MEMORY_SCOPE_SUB_GROUP=4
define: __PRAGMA_REDEFINE_EXTNAME=1
define: __VERSION__="Clang 10.0.0 "
define: __OBJC_BOOL_IS_BOOL=0
define: __CONSTANT_CFSTRINGS__=1
define: __DEPRECATED=1
define: _WCHAR_T_DEFINED=1
define: _NATIVE_WCHAR_T_DEFINED=1
define: __ORDER_LITTLE_ENDIAN__=1234
define: __ORDER_BIG_ENDIAN__=4321
define: __ORDER_PDP_ENDIAN__=3412
define: __BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__
define: __LITTLE_ENDIAN__=1
define: __CHAR_BIT__=8
define: __SCHAR_MAX__=127
define: __SHRT_MAX__=32767
define: __INT_MAX__=2147483647
define: __LONG_MAX__=2147483647L
define: __LONG_LONG_MAX__=9223372036854775807LL
define: __WCHAR_MAX__=65535
define: __WINT_MAX__=65535
define: __INTMAX_MAX__=9223372036854775807LL
define: __SIZE_MAX__=18446744073709551615ULL
define: __UINTMAX_MAX__=18446744073709551615ULL
define: __PTRDIFF_MAX__=9223372036854775807LL
define: __INTPTR_MAX__=9223372036854775807LL
define: __UINTPTR_MAX__=18446744073709551615ULL
define: __SIZEOF_DOUBLE__=8
define: __SIZEOF_FLOAT__=4
define: __SIZEOF_INT__=4
define: __SIZEOF_LONG__=4
define: __SIZEOF_LONG_DOUBLE__=8
define: __SIZEOF_LONG_LONG__=8
define: __SIZEOF_POINTER__=8
define: __SIZEOF_SHORT__=2
define: __SIZEOF_PTRDIFF_T__=8
define: __SIZEOF_SIZE_T__=8
define: __SIZEOF_WCHAR_T__=2
define: __SIZEOF_WINT_T__=2
define: __SIZEOF_INT128__=16
define: __INTMAX_TYPE__=long long int
define: __INTMAX_FMTd__="lld"
define: __INTMAX_FMTi__="lli"
define: __INTMAX_C_SUFFIX__=LL
define: __UINTMAX_TYPE__=long long unsigned int
define: __UINTMAX_FMTo__="llo"
define: __UINTMAX_FMTu__="llu"
define: __UINTMAX_FMTx__="llx"
define: __UINTMAX_FMTX__="llX"
define: __UINTMAX_C_SUFFIX__=ULL
define: __INTMAX_WIDTH__=64
define: __PTRDIFF_TYPE__=long long int
define: __PTRDIFF_FMTd__="lld"
define: __PTRDIFF_FMTi__="lli"
define: __PTRDIFF_WIDTH__=64
define: __INTPTR_TYPE__=long long int
define: __INTPTR_FMTd__="lld"
define: __INTPTR_FMTi__="lli"
define: __INTPTR_WIDTH__=64
define: __SIZE_TYPE__=long long unsigned int
define: __SIZE_FMTo__="llo"
define: __SIZE_FMTu__="llu"
define: __SIZE_FMTx__="llx"
define: __SIZE_FMTX__="llX"
define: __SIZE_WIDTH__=64
define: __WCHAR_TYPE__=unsigned short
define: __WCHAR_WIDTH__=16
define: __WINT_TYPE__=unsigned short
define: __WINT_WIDTH__=16
define: __SIG_ATOMIC_WIDTH__=32
define: __SIG_ATOMIC_MAX__=2147483647
define: __CHAR16_TYPE__=unsigned short
define: __CHAR32_TYPE__=unsigned int
define: __UINTMAX_WIDTH__=64
define: __UINTPTR_TYPE__=long long unsigned int
define: __UINTPTR_FMTo__="llo"
define: __UINTPTR_FMTu__="llu"
define: __UINTPTR_FMTx__="llx"
define: __UINTPTR_FMTX__="llX"
define: __UINTPTR_WIDTH__=64
define: __FLT_DENORM_MIN__=1.40129846e-45F
define: __FLT_HAS_DENORM__=1
define: __FLT_DIG__=6
define: __FLT_DECIMAL_DIG__=9
define: __FLT_EPSILON__=1.19209290e-7F
define: __FLT_HAS_INFINITY__=1
define: __FLT_HAS_QUIET_NAN__=1
define: __FLT_MANT_DIG__=24
define: __FLT_MAX_10_EXP__=38
define: __FLT_MAX_EXP__=128
define: __FLT_MAX__=3.40282347e+38F
define: __FLT_MIN_10_EXP__=(-37)
define: __FLT_MIN_EXP__=(-125)
define: __FLT_MIN__=1.17549435e-38F
define: __DBL_DENORM_MIN__=4.9406564584124654e-324
define: __DBL_HAS_DENORM__=1
define: __DBL_DIG__=15
define: __DBL_DECIMAL_DIG__=17
define: __DBL_EPSILON__=2.2204460492503131e-16
define: __DBL_HAS_INFINITY__=1
define: __DBL_HAS_QUIET_NAN__=1
define: __DBL_MANT_DIG__=53
define: __DBL_MAX_10_EXP__=308
define: __DBL_MAX_EXP__=1024
define: __DBL_MAX__=1.7976931348623157e+308
define: __DBL_MIN_10_EXP__=(-307)
define: __DBL_MIN_EXP__=(-1021)
define: __DBL_MIN__=2.2250738585072014e-308
define: __LDBL_DENORM_MIN__=4.9406564584124654e-324L
define: __LDBL_HAS_DENORM__=1
define: __LDBL_DIG__=15
define: __LDBL_DECIMAL_DIG__=17
define: __LDBL_EPSILON__=2.2204460492503131e-16L
define: __LDBL_HAS_INFINITY__=1
define: __LDBL_HAS_QUIET_NAN__=1
define: __LDBL_MANT_DIG__=53
define: __LDBL_MAX_10_EXP__=308
define: __LDBL_MAX_EXP__=1024
define: __LDBL_MAX__=1.7976931348623157e+308L
define: __LDBL_MIN_10_EXP__=(-307)
define: __LDBL_MIN_EXP__=(-1021)
define: __LDBL_MIN__=2.2250738585072014e-308L
define: __POINTER_WIDTH__=64
define: __BIGGEST_ALIGNMENT__=16
define: __WCHAR_UNSIGNED__=1
define: __WINT_UNSIGNED__=1
define: __INT8_TYPE__=signed char
define: __INT8_FMTd__="hhd"
define: __INT8_FMTi__="hhi"
define: __INT8_C_SUFFIX__=
define: __INT16_TYPE__=short
define: __INT16_FMTd__="hd"
define: __INT16_FMTi__="hi"
define: __INT16_C_SUFFIX__=
define: __INT32_TYPE__=int
define: __INT32_FMTd__="d"
define: __INT32_FMTi__="i"
define: __INT32_C_SUFFIX__=
define: __INT64_TYPE__=long long int
define: __INT64_FMTd__="lld"
define: __INT64_FMTi__="lli"
define: __INT64_C_SUFFIX__=LL
define: __UINT8_TYPE__=unsigned char
define: __UINT8_FMTo__="hho"
define: __UINT8_FMTu__="hhu"
define: __UINT8_FMTx__="hhx"
define: __UINT8_FMTX__="hhX"
define: __UINT8_C_SUFFIX__=
define: __UINT8_MAX__=255
define: __INT8_MAX__=127
define: __UINT16_TYPE__=unsigned short
define: __UINT16_FMTo__="ho"
define: __UINT16_FMTu__="hu"
define: __UINT16_FMTx__="hx"
define: __UINT16_FMTX__="hX"
define: __UINT16_C_SUFFIX__=
define: __UINT16_MAX__=65535
define: __INT16_MAX__=32767
define: __UINT32_TYPE__=unsigned int
define: __UINT32_FMTo__="o"
define: __UINT32_FMTu__="u"
define: __UINT32_FMTx__="x"
define: __UINT32_FMTX__="X"
define: __UINT32_C_SUFFIX__=U
define: __UINT32_MAX__=4294967295U
define: __INT32_MAX__=2147483647
define: __UINT64_TYPE__=long long unsigned int
define: __UINT64_FMTo__="llo"
define: __UINT64_FMTu__="llu"
define: __UINT64_FMTx__="llx"
define: __UINT64_FMTX__="llX"
define: __UINT64_C_SUFFIX__=ULL
define: __UINT64_MAX__=18446744073709551615ULL
define: __INT64_MAX__=9223372036854775807LL
define: __INT_LEAST8_TYPE__=signed char
define: __INT_LEAST8_MAX__=127
define: __INT_LEAST8_FMTd__="hhd"
define: __INT_LEAST8_FMTi__="hhi"
define: __UINT_LEAST8_TYPE__=unsigned char
define: __UINT_LEAST8_MAX__=255
define: __UINT_LEAST8_FMTo__="hho"
define: __UINT_LEAST8_FMTu__="hhu"
define: __UINT_LEAST8_FMTx__="hhx"
define: __UINT_LEAST8_FMTX__="hhX"
define: __INT_LEAST16_TYPE__=short
define: __INT_LEAST16_MAX__=32767
define: __INT_LEAST16_FMTd__="hd"
define: __INT_LEAST16_FMTi__="hi"
define: __UINT_LEAST16_TYPE__=unsigned short
define: __UINT_LEAST16_MAX__=65535
define: __UINT_LEAST16_FMTo__="ho"
define: __UINT_LEAST16_FMTu__="hu"
define: __UINT_LEAST16_FMTx__="hx"
define: __UINT_LEAST16_FMTX__="hX"
define: __INT_LEAST32_TYPE__=int
define: __INT_LEAST32_MAX__=2147483647
define: __INT_LEAST32_FMTd__="d"
define: __INT_LEAST32_FMTi__="i"
define: __UINT_LEAST32_TYPE__=unsigned int
define: __UINT_LEAST32_MAX__=4294967295U
define: __UINT_LEAST32_FMTo__="o"
define: __UINT_LEAST32_FMTu__="u"
define: __UINT_LEAST32_FMTx__="x"
define: __UINT_LEAST32_FMTX__="X"
define: __INT_LEAST64_TYPE__=long long int
define: __INT_LEAST64_MAX__=9223372036854775807LL
define: __INT_LEAST64_FMTd__="lld"
define: __INT_LEAST64_FMTi__="lli"
define: __UINT_LEAST64_TYPE__=long long unsigned int
define: __UINT_LEAST64_MAX__=18446744073709551615ULL
define: __UINT_LEAST64_FMTo__="llo"
define: __UINT_LEAST64_FMTu__="llu"
define: __UINT_LEAST64_FMTx__="llx"
define: __UINT_LEAST64_FMTX__="llX"
define: __INT_FAST8_TYPE__=signed char
define: __INT_FAST8_MAX__=127
define: __INT_FAST8_FMTd__="hhd"
define: __INT_FAST8_FMTi__="hhi"
define: __UINT_FAST8_TYPE__=unsigned char
define: __UINT_FAST8_MAX__=255
define: __UINT_FAST8_FMTo__="hho"
define: __UINT_FAST8_FMTu__="hhu"
define: __UINT_FAST8_FMTx__="hhx"
define: __UINT_FAST8_FMTX__="hhX"
define: __INT_FAST16_TYPE__=short
define: __INT_FAST16_MAX__=32767
define: __INT_FAST16_FMTd__="hd"
define: __INT_FAST16_FMTi__="hi"
define: __UINT_FAST16_TYPE__=unsigned short
define: __UINT_FAST16_MAX__=65535
define: __UINT_FAST16_FMTo__="ho"
define: __UINT_FAST16_FMTu__="hu"
define: __UINT_FAST16_FMTx__="hx"
define: __UINT_FAST16_FMTX__="hX"
define: __INT_FAST32_TYPE__=int
define: __INT_FAST32_MAX__=2147483647
define: __INT_FAST32_FMTd__="d"
define: __INT_FAST32_FMTi__="i"
define: __UINT_FAST32_TYPE__=unsigned int
define: __UINT_FAST32_MAX__=4294967295U
define: __UINT_FAST32_FMTo__="o"
define: __UINT_FAST32_FMTu__="u"
define: __UINT_FAST32_FMTx__="x"
define: __UINT_FAST32_FMTX__="X"
define: __INT_FAST64_TYPE__=long long int
define: __INT_FAST64_MAX__=9223372036854775807LL
define: __INT_FAST64_FMTd__="lld"
define: __INT_FAST64_FMTi__="lli"
define: __UINT_FAST64_TYPE__=long long unsigned int
define: __UINT_FAST64_MAX__=18446744073709551615ULL
define: __UINT_FAST64_FMTo__="llo"
define: __UINT_FAST64_FMTu__="llu"
define: __UINT_FAST64_FMTx__="llx"
define: __UINT_FAST64_FMTX__="llX"
define: __USER_LABEL_PREFIX__=
define: __FINITE_MATH_ONLY__=0
define: __CLANG_ATOMIC_BOOL_LOCK_FREE=2
define: __CLANG_ATOMIC_CHAR_LOCK_FREE=2
define: __CLANG_ATOMIC_CHAR8_T_LOCK_FREE=2
define: __CLANG_ATOMIC_CHAR16_T_LOCK_FREE=2
define: __CLANG_ATOMIC_CHAR32_T_LOCK_FREE=2
define: __CLANG_ATOMIC_WCHAR_T_LOCK_FREE=2
define: __CLANG_ATOMIC_SHORT_LOCK_FREE=2
define: __CLANG_ATOMIC_INT_LOCK_FREE=2
define: __CLANG_ATOMIC_LONG_LOCK_FREE=2
define: __CLANG_ATOMIC_LLONG_LOCK_FREE=2
define: __CLANG_ATOMIC_POINTER_LOCK_FREE=2
define: __NO_INLINE__=1
define: __PIC__=2
define: __pic__=2
define: __FLT_EVAL_METHOD__=0
define: __FLT_RADIX__=2
define: __DECIMAL_DIG__=__LDBL_DECIMAL_DIG__
define: __SSP_STRONG__=2
define: __GCC_ASM_FLAG_OUTPUTS__=1
define: __code_model_small_=1
define: __amd64__=1
define: __amd64=1
define: __x86_64=1
define: __x86_64__=1
define: __SEG_GS=1
define: __SEG_FS=1
define: __seg_gs=__attribute__((address_space(256)))
define: __seg_fs=__attribute__((address_space(257)))
define: __k8=1
define: __k8__=1
define: __tune_k8__=1
define: __REGISTER_PREFIX__=
define: __NO_MATH_INLINES=1
define: __FXSR__=1
define: __SSE2__=1
define: __SSE2_MATH__=1
define: __SSE__=1
define: __SSE_MATH__=1
define: __MMX__=1
define: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1
define: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1
define: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1
define: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1
define: _WIN32=1
define: _WIN64=1
define: _CPPRTTI=1
define: _CPPUNWIND=1
define: __BOOL_DEFINED=1
define: _MSC_VER=1925
define: _MSC_FULL_VER=192528614
define: _MSC_BUILD=1
define: _HAS_CHAR16_T_LANGUAGE_SUPPORT=1
define: _MSVC_LANG=201705L
define: _MSC_EXTENSIONS=1
define: _RVALUE_REFERENCES_V2_SUPPORTED=1
define: _RVALUE_REFERENCES_SUPPORTED=1
define: _NATIVE_NULLPTR_SUPPORTED=1
define: _INTEGRAL_MAX_BITS=64
define: _M_X64=100
define: _M_AMD64=100
define: __STDC_HOSTED__=1
define: __cplusplus=202002L
define: __STDCPP_DEFAULT_NEW_ALIGNMENT__=16ULL
define: __STDC_UTF_16__=1
define: __STDC_UTF_32__=1
define: _MT=1
define: WIN32=1
define: _WINDOWS=1
define: WIN32
define: _WINDOWS
stdver: ms_c++latest
intelliSenseMode: msvc-x64
Checking for syntax errors: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp
Queueing IntelliSense update for files in translation unit of: C:\USERS\GZFRO\SOURCE\REPOS\PTX_TEST\MAIN.CPP
idle loop: reparsing the active document
textDocument/hover: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp (id: 5)
Checking for syntax errors: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp
Queueing IntelliSense update for files in translation unit of: C:\USERS\GZFRO\SOURCE\REPOS\PTX_TEST\MAIN.CPP
textDocument/hover: file:///c%3A/Users/gzfro/source/repos/ptx_test/main.cpp (id: 6)
cpptools/finishUpdateSquiggles
Error squiggle count: 4
Update IntelliSense time (sec): 1.074

Screenshots

issue

Language Service bug investigate

Most helpful comment

Running into this as well. Did some digging, the issue seems to be that there isn't even a MAIN.ipch generated, so I'm guessing the process fails entirely, instead of producing a bad intellisense cache. Any pointers on how to debug the process generating that cache file?

edit: think I narrowed this down to do the following:

If cmake tools provides the c++ configuration, https://github.com/microsoft/vscode-cmake-tools/blob/c271903ac976661e6fc60e407ed8df2c6a10e84a/src/cpptools.ts#L228 will instruct the language server to use the clang-x64 intellisensemode, but according to https://github.com/microsoft/vscode-cpptools/blob/e17ff5e93ef4061472328d4afff86d152e5fcb03/Extension/src/LanguageServer/configurations.ts#L432 that's not the intended use. The Clang 10.0.0 for MSVC is the clang-cl frontend for clang, which doesn't use the clang headers from llvm/clang/lib/Headers

In conclusion, I don't think this has anything to do with a change introduced in clang 10

All 9 comments

Hi @gzfrozen . Thanks for reporting this. I'm able to repro. It seems there may be something new in the Clang 10 headers that's confusing our IntelliSense parser.

Running into this as well. Did some digging, the issue seems to be that there isn't even a MAIN.ipch generated, so I'm guessing the process fails entirely, instead of producing a bad intellisense cache. Any pointers on how to debug the process generating that cache file?

edit: think I narrowed this down to do the following:

If cmake tools provides the c++ configuration, https://github.com/microsoft/vscode-cmake-tools/blob/c271903ac976661e6fc60e407ed8df2c6a10e84a/src/cpptools.ts#L228 will instruct the language server to use the clang-x64 intellisensemode, but according to https://github.com/microsoft/vscode-cpptools/blob/e17ff5e93ef4061472328d4afff86d152e5fcb03/Extension/src/LanguageServer/configurations.ts#L432 that's not the intended use. The Clang 10.0.0 for MSVC is the clang-cl frontend for clang, which doesn't use the clang headers from llvm/clang/lib/Headers

In conclusion, I don't think this has anything to do with a change introduced in clang 10

edit: think I narrowed this down to do the following:

If cmake tools provides the c++ configuration, https://github.com/microsoft/vscode-cmake-tools/blob/c271903ac976661e6fc60e407ed8df2c6a10e84a/src/cpptools.ts#L228 will instruct the language server to use the clang-x64 intellisensemode, but according to

https://github.com/microsoft/vscode-cpptools/blob/e17ff5e93ef4061472328d4afff86d152e5fcb03/Extension/src/LanguageServer/configurations.ts#L432

that's not the intended use. The Clang 10.0.0 for MSVC is the clang-cl frontend for clang, which doesn't use the clang headers from llvm/clang/lib/Headers
In conclusion, I don't think this has anything to do with a change introduced in clang 10

@justinkb Thank a lot for your investigation.

After saw your comment, I did some build and debug on the file you mentioned:
https://github.com/microsoft/vscode-cpptools/blob/e17ff5e93ef4061472328d4afff86d152e5fcb03/Extension/src/LanguageServer/configurations.ts#L432
and change it into:

        let isValid: boolean = false;
        if (compilerPathAndArgs.compilerName.endsWith("cl.exe") === configuration.intelliSenseMode.startsWith("msvc") ||
            compilerPathAndArgs.compilerName === "clang-cl.exe" && configuration.intelliSenseMode.startsWith("clang")
        ) {
            isValid = true;
        }

which means now it can pass the test with the combination of "clang-cl.exe" and "clang-x64".
However it didn't work and the std namespace error still exists.

Later I find that this validation here is not relevant to cmake tools, but only relevant to the cpptools setting. configuration.intelliSenseMode is actually defined by user settings rather than pass by cmake tools.

So, maybe the true problem is not this one, although this mismatch between cpptools and cmake tools still remains a problem.

For my project I switched to a mingw GCC compiler for now, but I'd be happy
to help fox this issue for clang-cl. Let me know when you find some time to
take a look at this

On Wed, Jul 15, 2020, 7:57 PM gzfrozen notifications@github.com wrote:

edit: think I narrowed this down to do the following:

If cmake tools provides the c++ configuration,
https://github.com/microsoft/vscode-cmake-tools/blob/c271903ac976661e6fc60e407ed8df2c6a10e84a/src/cpptools.ts#L228
will instruct the language server to use the clang-x64 intellisensemode,
but according to

https://github.com/microsoft/vscode-cpptools/blob/e17ff5e93ef4061472328d4afff86d152e5fcb03/Extension/src/LanguageServer/configurations.ts#L432

that's not the intended use. The Clang 10.0.0 for MSVC is the clang-cl
frontend for clang, which doesn't use the clang headers from
llvm/clang/lib/Headers
In conclusion, I don't think this has anything to do with a change
introduced in clang 10

@justinkb https://github.com/justinkb Thank a lot for your investment.

After saw your comment, I did some build and debug on the file you
mentioned:

https://github.com/microsoft/vscode-cpptools/blob/e17ff5e93ef4061472328d4afff86d152e5fcb03/Extension/src/LanguageServer/configurations.ts#L432
and change it into:

    let isValid: boolean = false;
    if (compilerPathAndArgs.compilerName.endsWith("cl.exe") === configuration.intelliSenseMode.startsWith("msvc") ||
        compilerPathAndArgs.compilerName === "clang-cl.exe" && configuration.intelliSenseMode.startsWith("clang")
    ) {
        isValid = true;
    }

which means now it can pass the test with the combination of
"clang-cl.exe" and "clang-x64".
However it didn't work and the std namespace error still exists.

Later I find that this validation here is not relevant to cmake tools, but
only relevant to the cpptools setting. configuration.intelliSenseMode is
actually defined by user settings rather than pass by cmake tools.

So, maybe the true problem is not this one, although this mismatch between
cpptools and cmake tools still remains a problem.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/vscode-cpptools/issues/5456#issuecomment-658913953,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AABVHKCGCSYWBBOP6SJ2TTDR3XU2FANCNFSM4M5KO35Q
.

For now I got around this issue by removing configurationProvider and compileCommands and adding necessary includePath paths. My c_cpp_properties.json looks like this:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/VulkanSDK/1.2.148.1/Include/",
                "C:/vcpkg/installed/x64-windows/include/"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

For now I got around this issue by removing configurationProvider and compileCommands and adding necessary includePath paths. My c_cpp_properties.json looks like this:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/VulkanSDK/1.2.148.1/Include/",
                "C:/vcpkg/installed/x64-windows/include/"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

@Doeke
Thank you for your suggestion.

I tried this in my project. Remove configurationProvider did make most of the red alerts disappear, however the language server seemed still can not find where the std::out is, it just ignored the alerts. Adding specific including path seemed make no difference.

@gzfrozen Unfortunately I tried a lot of things to get the intellisense from C/C++ extension to work for me and I'm not sure specifically what change made it work. You could try messing with workspace settings like C_Cpp.default.intelliSenseMode, C_Cpp.vcpkg.enabled, or C_Cpp.default.compilerPath

Hi, I just found that this namespace std issue has just been fixed by
https://github.com/microsoft/vscode-cpptools/releases/tag/1.1.0-insiders.

Perhaps it is related to this issue: https://github.com/microsoft/vscode-cpptools/issues/6075.

I think we can close this issue now. @Colengms

Thanks @gzfrozen. Indeed, we changed how we handle clang-cl. We'll keep #6075 open to track the issue until 1.1.0 is released, and close this one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wdc596933938 picture wdc596933938  Â·  3Comments

vicatcu picture vicatcu  Â·  3Comments

montery8 picture montery8  Â·  3Comments

jheinzel picture jheinzel  Â·  3Comments

ismadelgad11 picture ismadelgad11  Â·  3Comments