microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.45k stars 1.53k forks source link

Code Analysis not finding headers on WSL2 #11395

Closed parsley72 closed 10 months ago

parsley72 commented 1 year ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary: Code Analysis is failing to find headers referenced in the code.

Steps to reproduce: I can't give you source code because it's proprietary but I'm using Yocto to build a CMake project.

#ifndef __UTILS_H__
#define __UTILS_H__

#include <filesystem>
#include <string>

Both headers are underlined with the error "cannot open source file" and the file shows the error "#include errors detected. Consider updating your compile_commands.json or includePath. Squiggles are disabled for this translation unit" I can run find oe-workdir/recipe-sysroot/usr -name filesystem (the include path specified below) and get oe-workdir/recipe-sysroot/usr/include/c++/9.5.0/filesystem back, so I know it's there.

Expected behavior: Headers should be found. What's odd is that I have SonarLint installed which seems to find the headers fine.

Configuration and Logs

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/",
                "${workspaceFolder}/app/",
                "${workspaceFolder}/oe-workdir/recipe-sysroot/usr/**"
            ],
            "defines": [],
            "compilerPath": "${workspaceFolder}/oe-workdir/recipe-sysroot-native/usr/bin/aarch64-oclea-linux/aarch64-oclea-linux-gcc",
            "cStandard": "c17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "linux-gcc-arm64",
            "compileCommands": "${workspaceFolder}/.vscode/compile_commands.json"
        }
    ],
    "version": 4
}

LSP: cpptools/runCodeAnalysis
/home/tom/.vscode-server/extensions/ms-vscode.cpptools-1.17.5-linux-x64/bin/../LLVM/bin/clang-tidy
--header-filter=/home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app
-p
/home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app/.vscode/compile_commands.json
--export-fixes=/tmp/{13760475409157101770}/fixes140095673707312.yaml
--quiet
--use-color=false
/home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app/app/traffic_app.cpp
--
-std=gnu++17
-xc++
-Wno-pragma-pack
-Wno-pragma-once-outside-header
-DAPP_RELEASE_VERSION=1.0.56-1-gfe486f1-dirty
-DAWS_AUTH_USE_IMPORT_EXPORT
-DAWS_CAL_USE_IMPORT_EXPORT
-DAWS_CHECKSUMS_USE_IMPORT_EXPORT
-DAWS_COMMON_USE_IMPORT_EXPORT
-DAWS_COMPRESSION_USE_IMPORT_EXPORT
-DAWS_CRT_CPP_USE_IMPORT_EXPORT
-DAWS_EVENT_STREAM_USE_IMPORT_EXPORT
-DAWS_HTTP_USE_IMPORT_EXPORT
-DAWS_IO_USE_IMPORT_EXPORT
-DAWS_MQTT_USE_IMPORT_EXPORT
-DAWS_MQTT_WITH_WEBSOCKETS
-DAWS_S3_USE_IMPORT_EXPORT
-DAWS_SDKUTILS_USE_IMPORT_EXPORT
-DAWS_SDK_VERSION_MAJOR=1
-DAWS_SDK_VERSION_MINOR=9
-DAWS_SDK_VERSION_PATCH=379
-DAWS_USE_EPOLL
-DPLATFORM_LINUX=1
-D_FORTIFY_SOURCE=2
-D_FORTIFY_SOURCE=2
-DNDEBUG
-DS2N_STACKTRACE
-DS2N_FEATURES_AVAILABLE
-DS2N_FALL_THROUGH_SUPPORTED
-DS2N___RESTRICT__SUPPORTED
-DS2N_MADVISE_SUPPORTED
-DS2N_CLONE_SUPPORTED
-DS2N_LIBCRYPTO_SUPPORTS_EVP_MD5_SHA1_HASH
-DS2N_LIBCRYPTO_SUPPORTS_EVP_RC4
-DS2N_LIBCRYPTO_SUPPORTS_EVP_MD_CTX_SET_PKEY_CTX
-D__SSP_STRONG__=3
-D__DBL_MIN_EXP__=(-1021)
-D__cpp_attributes=200809L
-D__cpp_nontype_template_parameter_auto=201606L
-D__UINT_LEAST16_MAX__=0xffff
-D__ATOMIC_ACQUIRE=2
-D__FLT128_MAX_10_EXP__=4932
-D__FLT_MIN__=1.17549435082228750796873653722224568e-38F
-D__GCC_IEC_559_COMPLEX=2
-D__cpp_aggregate_nsdmi=201304L
-D__UINT_LEAST8_TYPE__=unsigned char
-D__INTMAX_C(c)=c ## L
-D__CHAR_BIT__=8
-D__UINT8_MAX__=0xff
-D__SCHAR_WIDTH__=8
-D__WINT_MAX__=0xffffffffU
-D__FLT32_MIN_EXP__=(-125)
-D__cpp_static_assert=201411L
-D__ORDER_LITTLE_ENDIAN__=1234
-D__SIZE_MAX__=0xffffffffffffffffUL
-D__WCHAR_MAX__=0x7fffffff
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1
-D__DBL_DENORM_MIN__=double(4.94065645841246544176568792868221372e-324L)
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1
-D__GCC_ATOMIC_CHAR_LOCK_FREE=2
-D__GCC_IEC_559=2
-D__FLT32X_DECIMAL_DIG__=17
-D__FLT_EVAL_METHOD__=0
-D__cpp_binary_literals=201304L
-D__FLT64_DECIMAL_DIG__=17
-D__CET__=3
-D__cpp_noexcept_function_type=201510L
-D__GCC_ATOMIC_CHAR32_T_LOCK_FREE=2
-D__cpp_variadic_templates=200704L
-D__UINT_FAST64_MAX__=0xffffffffffffffffUL
-D__SIG_ATOMIC_TYPE__=int
-D__DBL_MIN_10_EXP__=(-307)
-D__FINITE_MATH_ONLY__=0
-D__cpp_variable_templates=201304L
-D__FLT32X_MAX_EXP__=1024
-D__FLT32_HAS_DENORM__=1
-D__UINT_FAST8_MAX__=0xff
-D__cpp_rvalue_reference=200610L
-D__cpp_nested_namespace_definitions=201411L
-D__DEC64_MAX_EXP__=385
-D__INT8_C(c)=c
-D__INT_LEAST8_WIDTH__=8
-D__cpp_variadic_using=201611L
-D__UINT_LEAST64_MAX__=0xffffffffffffffffUL
-D__INT_LEAST8_MAX__=0x7f
-D__cpp_capture_star_this=201603L
-D__SHRT_MAX__=0x7fff
-D__LDBL_MAX__=1.18973149535723176502126385303097021e+4932L
-D__FLT64X_MAX_10_EXP__=4932
-D__cpp_if_constexpr=201606L
-D__LDBL_IS_IEC_60559__=2
-D__FLT64X_HAS_QUIET_NAN__=1
-D__UINT_LEAST8_MAX__=0xff
-D__GCC_ATOMIC_BOOL_LOCK_FREE=2
-D__FLT128_DENORM_MIN__=6.47517511943802511092443895822764655e-4966F128
-D__UINTMAX_TYPE__=long unsigned int
-D__linux=1
-D__DEC32_EPSILON__=1E-6DF
-D__FLT_EVAL_METHOD_TS_18661_3__=0
-D__unix=1
-D__UINT32_MAX__=0xffffffffU
-D__GXX_EXPERIMENTAL_CXX0X__=1
-D__FLT128_MIN_EXP__=(-16381)
-D__WINT_MIN__=0U
-D__FLT128_MIN_10_EXP__=(-4931)
-D__FLT32X_IS_IEC_60559__=2
-D__INT_LEAST16_WIDTH__=16
-D__SCHAR_MAX__=0x7f
-D__FLT128_MANT_DIG__=113
-D__WCHAR_MIN__=(-__WCHAR_MAX__ - 1)
-D__INT64_C(c)=c ## L
-D__GCC_ATOMIC_POINTER_LOCK_FREE=2
-D__FLT32X_MANT_DIG__=53
-D__GCC_ATOMIC_CHAR16_T_LOCK_FREE=2
-D__cpp_aligned_new=201606L
-D__USER_LABEL_PREFIX__=
-D__FLT32_MAX_10_EXP__=38
-D__FLT64X_EPSILON__=1.08420217248550443400745280086994171e-19F64x
-D__STDC_HOSTED__=1
-D__DEC64_MIN_EXP__=(-382)
-D__cpp_decltype_auto=201304L
-D__DBL_DIG__=15
-D__FLT32_DIG__=6
-D__FLT_EPSILON__=1.19209289550781250000000000000000000e-7F
-D__GXX_WEAK__=1
-D__SHRT_WIDTH__=16
-D__FLT32_IS_IEC_60559__=2
-D__LDBL_MIN__=3.36210314311209350626267781732175260e-4932L
-D__DBL_IS_IEC_60559__=2
-D__DEC32_MAX__=9.999999E96DF
-D__cpp_threadsafe_static_init=200806L
-D__cpp_enumerator_attributes=201411L
-D__FLT64X_DENORM_MIN__=3.64519953188247460252840593361941982e-4951F64x
-D__FLT32X_HAS_INFINITY__=1
-D__INT32_MAX__=0x7fffffff
-D__unix__=1
-D__INT_WIDTH__=32
-D__SIZEOF_LONG__=8
-D__STDC_IEC_559__=1
-D__STDC_ISO_10646__=201706L
-D__UINT16_C(c)=c
-D__DECIMAL_DIG__=21
-D__STDC_IEC_559_COMPLEX__=1
-D__FLT64_EPSILON__=2.22044604925031308084726333618164062e-16F64
-D__gnu_linux__=1
-D__INT16_MAX__=0x7fff
-D__FLT64_MIN_EXP__=(-1021)
-D__FLT64X_MIN_10_EXP__=(-4931)
-D__LDBL_HAS_QUIET_NAN__=1
-D__FLT64_MANT_DIG__=53
-D__FLT64X_MANT_DIG__=64
-D__GXX_RTTI=1
-D__pie__=2
-D__MMX__=1
-D__FLT_HAS_DENORM__=1
-D__SIZEOF_LONG_DOUBLE__=16
-D__BIGGEST_ALIGNMENT__=16
-D__STDC_UTF_16__=1
-D__FLT64_MAX_10_EXP__=308
-D__cpp_delegating_constructors=200604L
-D__FLT32_HAS_INFINITY__=1
-D__DBL_MAX__=double(1.79769313486231570814527423731704357e+308L)
-D__cpp_raw_strings=200710L
-D__INT_FAST32_MAX__=0x7fffffffffffffffL
-D__DBL_HAS_INFINITY__=1
-D__SIZEOF_FLOAT__=4
-D__HAVE_SPECULATION_SAFE_VALUE=1
-D__cpp_fold_expressions=201603L
-D__DEC32_MIN_EXP__=(-94)
-D__INTPTR_WIDTH__=64
-D__FLT64X_HAS_INFINITY__=1
-D__UINT_LEAST32_MAX__=0xffffffffU
-D__FLT32X_HAS_DENORM__=1
-D__INT_FAST16_TYPE__=long int
-D__MMX_WITH_SSE__=1
-D__LDBL_HAS_DENORM__=1
-D__cplusplus=201703L
-D__cpp_ref_qualifiers=200710L
-D__DEC32_MIN__=1E-95DF
-D__DEPRECATED=1
-D__cpp_rvalue_references=200610L
-D__DBL_MAX_EXP__=1024
-D__WCHAR_WIDTH__=32
-D__FLT32_MAX__=3.40282346638528859811704183484516925e+38F32
-D__DEC128_EPSILON__=1E-33DL
-D__ATOMIC_HLE_RELEASE=131072
-D__PTRDIFF_MAX__=0x7fffffffffffffffL
-D__amd64=1
-D__ATOMIC_HLE_ACQUIRE=65536
-D__GNUG__=11
-D__LONG_LONG_MAX__=0x7fffffffffffffffLL
-D__SIZEOF_SIZE_T__=8
-D__cpp_nsdmi=200809L
-D__FLT64X_MIN_EXP__=(-16381)
-D__SIZEOF_WINT_T__=4
-D__LONG_LONG_WIDTH__=64
-D__cpp_initializer_lists=200806L
-D__FLT32_MAX_EXP__=128
-D__cpp_hex_float=201603L
-D__GXX_ABI_VERSION=1016
-D__FLT128_HAS_INFINITY__=1
-D__FLT_MIN_EXP__=(-125)
-D__GCC_HAVE_DWARF2_CFI_ASM=1
-D__x86_64=1
-D__cpp_lambdas=200907L
-D__INT_FAST64_TYPE__=long int
-D__FLT64_DENORM_MIN__=4.94065645841246544176568792868221372e-324F64
-D__cpp_template_auto=201606L
-D__DBL_MIN__=double(2.22507385850720138309023271733240406e-308L)
-D__FLT128_EPSILON__=1.92592994438723585305597794258492732e-34F128
-D__FLT64X_NORM_MAX__=1.18973149535723176502126385303097021e+4932F64x
-D__SIZEOF_POINTER__=8
-D__LP64__=1
-D__DBL_HAS_QUIET_NAN__=1
-D__FLT32X_EPSILON__=2.22044604925031308084726333618164062e-16F32x
-D__DECIMAL_BID_FORMAT__=1
-D__FLT64_MIN_10_EXP__=(-307)
-D__FLT64X_DECIMAL_DIG__=21
-D__DEC128_MIN__=1E-6143DL
-D__REGISTER_PREFIX__=
-D__UINT16_MAX__=0xffff
-D__LDBL_HAS_INFINITY__=1
-D__FLT32_MIN__=1.17549435082228750796873653722224568e-38F32
-D__UINT8_TYPE__=unsigned char
-D__FLT_DIG__=6
-D__NO_INLINE__=1
-D__DEC_EVAL_METHOD__=2
-D__DEC128_MAX__=9.999999999999999999999999999999999E6144DL
-D__FLT_MANT_DIG__=24
-D__LDBL_DECIMAL_DIG__=21
-D__UINT64_C(c)=c ## UL
-D__cpp_unicode_characters=201411L
-D_STDC_PREDEF_H=1
-D__INT_LEAST32_MAX__=0x7fffffff
-D__GCC_ATOMIC_INT_LOCK_FREE=2
-D__FLT128_MAX_EXP__=16384
-D__FLT32_MANT_DIG__=24
-D__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__
-D__STDC_IEC_60559_COMPLEX__=201404L
-D__cpp_aggregate_bases=201603L
-D__FLT128_HAS_DENORM__=1
-D__FLT32_DECIMAL_DIG__=9
-D__FLT128_DIG__=33
-D__INT32_C(c)=c
-D__DEC64_EPSILON__=1E-15DD
-D__ORDER_PDP_ENDIAN__=3412
-D__DEC128_MIN_EXP__=(-6142)
-D__INT_FAST32_TYPE__=long int
-D__UINT_LEAST16_TYPE__=short unsigned int
-Dunix=1
-D__DBL_HAS_DENORM__=1
-D__cpp_rtti=199711L
-D__SIZE_TYPE__=long unsigned int
-D__UINT64_MAX__=0xffffffffffffffffUL
-D__FLT_IS_IEC_60559__=2
-D__GNUC_WIDE_EXECUTION_CHARSET_NAME="UTF-32LE"
-D__FLT64X_DIG__=18
-D__INT8_TYPE__=signed char
-D__cpp_digit_separators=201309L
-D__ELF__=1
-D__GCC_ASM_FLAG_OUTPUTS__=1
-D__UINT32_TYPE__=unsigned int
-D__FLT_RADIX__=2
-D__INT_LEAST16_TYPE__=short int
-D__LDBL_EPSILON__=1.08420217248550443400745280086994171e-19L
-D__UINTMAX_C(c)=c ## UL
-D__GLIBCXX_BITSIZE_INT_N_0=128
-D__k8=1
-D__FLT32X_MIN__=2.22507385850720138309023271733240406e-308F32x
-D__SIG_ATOMIC_MAX__=0x7fffffff
-D__GCC_ATOMIC_WCHAR_T_LOCK_FREE=2
-D__STDC_IEC_60559_BFP__=201404L
-D__SIZEOF_PTRDIFF_T__=8
-D__LDBL_DIG__=18
-D__FLT64_IS_IEC_60559__=2
-D__x86_64__=1
-D__FLT32X_MIN_EXP__=(-1021)
-D__DEC32_SUBNORMAL_MIN__=0.000001E-95DF
-D__INT_FAST16_MAX__=0x7fffffffffffffffL
-D__FLT64_DIG__=15
-D__UINT_FAST32_MAX__=0xffffffffffffffffUL
-D__UINT_LEAST64_TYPE__=long unsigned int
-D__FLT_HAS_QUIET_NAN__=1
-D__FLT_MAX_10_EXP__=38
-D__LONG_MAX__=0x7fffffffffffffffL
-D__FLT64X_HAS_DENORM__=1
-D__DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL
-D__FLT_HAS_INFINITY__=1
-D__GNUC_EXECUTION_CHARSET_NAME="UTF-8"
-D__cpp_unicode_literals=200710L
-D__UINT_FAST16_TYPE__=long unsigned int
-D__DEC64_MAX__=9.999999999999999E384DD
-D__INT_FAST32_WIDTH__=64
-D__CHAR16_TYPE__=short unsigned int
-D__PRAGMA_REDEFINE_EXTNAME=1
-D__SIZE_WIDTH__=64
-D__SEG_FS=1
-D__INT_LEAST16_MAX__=0x7fff
-D__DEC64_MANT_DIG__=16
-D__INT64_MAX__=0x7fffffffffffffffL
-D__SEG_GS=1
-D__FLT32_DENORM_MIN__=1.40129846432481707092372958328991613e-45F32
-D__SIG_ATOMIC_WIDTH__=32
-D__INT_LEAST64_TYPE__=long int
-D__INT16_TYPE__=short int
-D__INT_LEAST8_TYPE__=signed char
-D__cpp_structured_bindings=201606L
-D__SIZEOF_INT__=4
-D__DEC32_MAX_EXP__=97
-D__INT_FAST8_MAX__=0x7f
-D__FLT128_MAX__=1.18973149535723176508575932662800702e+4932F128
-D__INTPTR_MAX__=0x7fffffffffffffffL
-D__cpp_guaranteed_copy_elision=201606L
-Dlinux=1
-D__FLT64_HAS_QUIET_NAN__=1
-D__FLT32_MIN_10_EXP__=(-37)
-D__EXCEPTIONS=1
-D__PTRDIFF_WIDTH__=64
-D__LDBL_MANT_DIG__=64
-D__cpp_range_based_for=201603L
-D__FLT64_HAS_INFINITY__=1
-D__FLT64X_MAX__=1.18973149535723176502126385303097021e+4932F64x
-D__STDCPP_DEFAULT_NEW_ALIGNMENT__=16
-D__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)
-D__code_model_small__=1
-D__GCC_ATOMIC_LONG_LOCK_FREE=2
-D__cpp_nontype_template_args=201411L
-D__DEC32_MANT_DIG__=7
-D__cpp_return_type_deduction=201304L
-D__k8__=1
-D__INTPTR_TYPE__=long int
-D__UINT16_TYPE__=short unsigned int
-D__WCHAR_TYPE__=int
-D__pic__=2
-D__UINTPTR_MAX__=0xffffffffffffffffUL
-D__INT_FAST64_WIDTH__=64
-D__cpp_decltype=200707L
-D__INT_FAST64_MAX__=0x7fffffffffffffffL
-D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1
-D__FLT_NORM_MAX__=3.40282346638528859811704183484516925e+38F
-D__FLT64X_MAX_EXP__=16384
-D__UINT_FAST64_TYPE__=long unsigned int
-D__cpp_inline_variables=201606L
-D__INT_MAX__=0x7fffffff
-D__linux__=1
-D__INT64_TYPE__=long int
-D__FLT_MAX_EXP__=128
-D__ORDER_BIG_ENDIAN__=4321
-D__DBL_MANT_DIG__=53
-D__cpp_inheriting_constructors=201511L
-D__SIZEOF_FLOAT128__=16
-D__INT_LEAST64_MAX__=0x7fffffffffffffffL
-D__DEC64_MIN__=1E-383DD
-D__WINT_TYPE__=unsigned int
-D__UINT_LEAST32_TYPE__=unsigned int
-D__SIZEOF_SHORT__=2
-D__FLT32_NORM_MAX__=3.40282346638528859811704183484516925e+38F32
-D__LDBL_MIN_EXP__=(-16381)
-D__FLT64_MAX__=1.79769313486231570814527423731704357e+308F64
-D__amd64__=1
-D__WINT_WIDTH__=32
-D__INT_LEAST64_WIDTH__=64
-D__LDBL_MAX_EXP__=16384
-D__FLT32X_MAX_10_EXP__=308
-D__SIZEOF_INT128__=16
-D__FLT64X_IS_IEC_60559__=2
-D__LDBL_MAX_10_EXP__=4932
-D__ATOMIC_RELAXED=0
-D__DBL_EPSILON__=double(2.22044604925031308084726333618164062e-16L)
-D__FLT128_MIN__=3.36210314311209350626267781732175260e-4932F128
-D_LP64=1
-D__UINT8_C(c)=c
-D__FLT64_MAX_EXP__=1024
-D__INT_LEAST32_TYPE__=int
-D__SIZEOF_WCHAR_T__=4
-D__FLT128_NORM_MAX__=1.18973149535723176508575932662800702e+4932F128
-D__FLT64_NORM_MAX__=1.79769313486231570814527423731704357e+308F64
-D__FLT128_HAS_QUIET_NAN__=1
-D__INTMAX_MAX__=0x7fffffffffffffffL
-D__INT_FAST8_TYPE__=signed char
-D__cpp_namespace_attributes=201411L
-D__FLT64X_MIN__=3.36210314311209350626267781732175260e-4932F64x
-D__STDCPP_THREADS__=1
-D__GNUC_STDC_INLINE__=1
-D__FLT64_HAS_DENORM__=1
-D__FLT32_EPSILON__=1.19209289550781250000000000000000000e-7F32
-D__DBL_DECIMAL_DIG__=17
-D__STDC_UTF_32__=1
-D__INT_FAST8_WIDTH__=8
-D__FXSR__=1
-D__FLT32X_MAX__=1.79769313486231570814527423731704357e+308F32x
-D__DBL_NORM_MAX__=double(1.79769313486231570814527423731704357e+308L)
-D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__
-D__INTMAX_WIDTH__=64
-D__cpp_runtime_arrays=198712L
-D__UINT64_TYPE__=long unsigned int
-D__UINT32_C(c)=c ## U
-D__cpp_alias_templates=200704L
-D__FLT_DENORM_MIN__=1.40129846432481707092372958328991613e-45F
-D__FLT128_IS_IEC_60559__=2
-D__INT8_MAX__=0x7f
-D__LONG_WIDTH__=64
-D__PIC__=2
-D__UINT_FAST32_TYPE__=long unsigned int
-D__FLT32X_NORM_MAX__=1.79769313486231570814527423731704357e+308F32x
-D__CHAR32_TYPE__=unsigned int
-D__FLT_MAX__=3.40282346638528859811704183484516925e+38F
-D__cpp_constexpr=201603L
-D__cpp_deduction_guides=201703L
-D__INT32_TYPE__=int
-D__SIZEOF_DOUBLE__=8
-D__cpp_exceptions=199711L
-D__FLT_MIN_10_EXP__=(-37)
-D__FLT64_MIN__=2.22507385850720138309023271733240406e-308F64
-D__INT_LEAST32_WIDTH__=32
-D__INTMAX_TYPE__=long int
-D__DEC128_MAX_EXP__=6145
-D__FLT32X_HAS_QUIET_NAN__=1
-D__ATOMIC_CONSUME=1
-D__GLIBCXX_TYPE_INT_N_0=__int128
-D__INT_FAST16_WIDTH__=64
-D__UINTMAX_MAX__=0xffffffffffffffffUL
-D__PIE__=2
-D__FLT32X_DENORM_MIN__=4.94065645841246544176568792868221372e-324F32x
-D__cpp_template_template_args=201611L
-D__DBL_MAX_10_EXP__=308
-D__LDBL_DENORM_MIN__=3.64519953188247460252840593361941982e-4951L
-D__INT16_C(c)=c
-D__STDC__=1
-D__FLT32X_DIG__=15
-D__PTRDIFF_TYPE__=long int
-D__ATOMIC_SEQ_CST=5
-D__FLT32X_MIN_10_EXP__=(-307)
-D__UINTPTR_TYPE__=long unsigned int
-D__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD
-D__DEC128_MANT_DIG__=34
-D__LDBL_MIN_10_EXP__=(-4931)
-D__cpp_generic_lambdas=201304L
-D__SIZEOF_LONG_LONG__=8
-D__cpp_user_defined_literals=200809L
-D__FLT128_DECIMAL_DIG__=36
-D__GCC_ATOMIC_LLONG_LOCK_FREE=2
-D__FLT32_HAS_QUIET_NAN__=1
-D__FLT_DECIMAL_DIG__=9
-D__UINT_FAST16_MAX__=0xffffffffffffffffUL
-D__LDBL_NORM_MAX__=1.18973149535723176502126385303097021e+4932L
-D__GCC_ATOMIC_SHORT_LOCK_FREE=2
-D__UINT_FAST8_TYPE__=unsigned char
-D_GNU_SOURCE=1
-D__cpp_init_captures=201304L
-D__ATOMIC_ACQ_REL=4
-D__ATOMIC_RELEASE=3
-I/home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app/app
-I/home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app/lib/include
-I/home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app/ble-provision
-I/home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app/app/lpr_plugins
-isystem/usr/include/c++/11
-isystem/usr/include/x86_64-linux-gnu/c++/11
-isystem/usr/include/c++/11/backward
-isystem/usr/lib/gcc/x86_64-linux-gnu/11/include
-isystem/usr/local/include
-isystem/usr/include/x86_64-linux-gnu
-isystem/usr/include
Error while processing /home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app/app/traffic_app.cpp.
warning: redefining builtin macro [clang-diagnostic-builtin-macro-redefined]
/home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app/app/traffic_interface.h:7:10: error: 'glib.h' file not found [clang-diagnostic-error]
    7 | #include <glib.h>
      |          ^~~~~~~~
LSP: cpptools/activeDocumentChange: file:///home/tom/Documents/Bitbucket/motorola-l6q/oclea-yocto-sdk/source/motorola-app/app/cloud_service.h
LSP: cpptools/textEditorSelectionChange

Other Extensions

No response

Additional context

No response

parsley72 commented 1 year ago

Replying to @Colengms question here, I'm not sure what locate has to do with this if I'm specifying the path in .vscode/c_cpp_properties.json?

parsley72 commented 1 year ago

I've found a way around this problem - get rid of .vscode/c_cpp_properties.json and just put all the entries in .vscode/settings.json under C_Cpp.default.. So my settings file now looks like:

{
    "C_Cpp.default.includePath": [
        "${workspaceFolder}/src/**",
        "${workspaceFolder}/include/**",
        "${workspaceFolder}/oe-workdir/recipe-sysroot/usr/**"
    ],
    "C_Cpp.default.defines": [],
    "C_Cpp.default.compilerPath": "${workspaceFolder}/oe-workdir/recipe-sysroot-native/usr/bin/aarch64-oclea-linux/aarch64-oclea-linux-gcc",
    "C_Cpp.default.cStandard": "c17",
    "C_Cpp.default.cppStandard": "gnu++17",
    "C_Cpp.default.intelliSenseMode": "linux-gcc-arm64",
    "C_Cpp.default.compileCommands": "${workspaceFolder}/.vscode/compile_commands.json"
}

I wonder if WSL2 isn't picking up the "Linux" section in c_cpp_properties.json properly?

parsley72 commented 1 year ago

Just noticed that now I've moved everything to .vscode/settings.json, when I open the project in the "C/C++ Configuration Warnings" output window I get:

[9/4/2023, 2:44:24 PM] For C++ source files, IntelliSenseMode was changed from "linux-gcc-arm64" to "linux-gcc-x64" based on compiler args and querying compilerPath: "/usr/bin/gcc"
[9/4/2023, 2:44:24 PM] IntelliSenseMode was changed because it didn't match the detected compiler.  Consider setting "compilerPath" instead.  Set "compilerPath" to "" to disable detection of system includes and defines.
[9/4/2023, 2:44:24 PM] For C source files, IntelliSenseMode was changed from "linux-gcc-arm64" to "linux-gcc-x64" based on compiler args and querying compilerPath: "/usr/bin/gcc"
[9/4/2023, 2:44:24 PM] IntelliSenseMode was changed because it didn't match the detected compiler.  Consider setting "compilerPath" instead.  Set "compilerPath" to "" to disable detection of system includes and defines.

Not sure what effect that has, but it's better than not finding the headers so I'll leave it like this. But either way something isn't working properly.

bobbrow commented 1 year ago

You shouldn't need to delete your c_cpp_properties.json to make this work. If you are compiling with a specific sysroot and IntelliSense isn't picking it up for some reason, I would recommend adding that to the compilerArgs property instead of the includePath because gcc/clang compilers have a specific default include path ordering that we want the language server to pick up.

I would normally recommend trying something like this, but I just noticed that you have a compile_commands.json and our language server prefers taking source file configurations from there over the compilerPath/compilerArgs/includePath properties:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/",
                "${workspaceFolder}/app/",
            ],
            "defines": [],
            "compilerPath": "${workspaceFolder}/oe-workdir/recipe-sysroot-native/usr/bin/aarch64-oclea-linux/aarch64-oclea-linux-gcc",
            "compilerArgs": [
                "--sysroot",
                "${workspaceFolder}/oe-workdir/recipe-sysroot"
            ]
            "cStandard": "c17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "linux-gcc-arm64",
            "compileCommands": "${workspaceFolder}/.vscode/compile_commands.json"
        }
    ],
    "version": 4

}

Can you share the compile_commands entry for the source file that is showing red squiggles for you? We'll see if there are any clues there.

parsley72 commented 1 year ago

That seems to fix the red sqiggles and I'm not seeing anything in the "C/C++ Configuration Warnings" output window.

Colengms commented 1 year ago

I'm not sure what locate has to do with this if I'm specifying the path in .vscode/c_cpp_properties.json?

Hi @parsley72 . If your c_cpp_properties.json file contains a compileCommands entry, that will take precedence over all other fields, for any files found in that compile_commands.json file. (Header files included to by source files in compile_commands.json will also use that source file's compile_commands.json entry to configure IntelliSense). That would explain why changes you've made to include paths, etc., may not appear to be effective. It would also seem to imply that configuration issues you're seeing are either due to issues with the contents of the compile_commands.json file, or perhaps some arguments on those command lines that are not being parsed properly. Are you successfully able to build using your compile_commands.json file?

Since you mentioned using CMake, I'd suggest using the CMake Tools extension, and specifying it as a configurationProvider (which will also take precedence over other configuration fields).

Note that "#include errors detected. Consider updating your compile_commands.json or includePath. Squiggles are disabled for this translation unit" is not related to "Code Analysis". That error message is coming from IntelliSense. Whereas, "Code Analysis" involves invoking clang-tidy, a 3rd party tool which, coincidentally, leverages your compile_commands.json file directly. But it sounds like both are exhibiting a similar 'file not found' error.

parsley72 commented 1 year ago

@Colengms I think you missed my comment above - adding the --sysroot to compilerArgs seems to have fixed my problem. If compile_commands.json is overriding these then I have no idea how this is making a difference.

Colengms commented 1 year ago

Hi @parsley72 . That would seem to imply that the file you are repro'ing with was not successfully found in compile_commands.json. If it were, paths from your base configuraiton would not have been used. The output of the C/C++: Log Diagnostics command, while that file is opened, should indicate whether a compiler_commands.json entry was used to configure the file or not.

github-actions[bot] commented 10 months ago

This issue has been closed because it needs more information and has not had recent activity.