microsoft / vscode-cpptools

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

wrong/useless include errors detected #8951

Open FStefanni opened 2 years ago

FStefanni commented 2 years ago

Bug type: Language Service

Describe the bug

Opening a header file, the first line reports:

#include errors detected. Please update your includePath. IntelliSense features for this translation unit (/home/kappa/Arduino/libraries/coreino/src/coreino.h) will be provided by the Tag Parser.C/C++(1696)

The first line is the usual "#ifndef" include guard. The bug is: includes are actually fine, imho. But, if there is an error, it would be nice to know which is the error or where it is, in order to fix/improve/update my config. Unfortunately the current error message is not useful.

Please note that it is a multi-root workspace, and not all roots contain C++ code.

Expected behavior

To just work, since includes are fine imho, or a useful message, reporting which is the missing header, or the file which is generating the error.

Code sample and logs

#ifndef ARDUINO_COREINO_H // <-- THIS IS THE LINE SHOWING THE ERROR
#define ARDUINO_COREINO_H

#include "../include/coreino.hpp"

#endif

------- Workspace parsing diagnostics ------- Number of files discovered (not excluded): 30124 Number of files parsed: 1331

- Logs from [the language server logging](https://code.visualstudio.com/docs/cpp/enable-logging-cpp#_enable-logging-for-the-language-server)

loggingLevel: Debug cpptools/didChangeCppProperties Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c++17 -Wp,-v -E -dM -x c++ -m64 /dev/null terminating child process: 35562 Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c17 -Wp,-v -E -dM -x c -m64 /dev/null terminating child process: 35567 Folder: /usr/include/ will be indexed Folder: /usr/lib/gcc/x86_64-linux-gnu/11/include/ will be indexed Folder: /usr/local/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/8.3.0/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ will be indexed Folder: /home/kappa/Arduino/libraries/coreino/ will be indexed cpptools/didChangeCppProperties Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c++17 -Wp,-v -E -dM -x c++ -m64 /dev/null terminating child process: 35569 Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c17 -Wp,-v -E -dM -x c -m64 /dev/null terminating child process: 35571 Folder: /usr/include/ will be indexed Folder: /usr/lib/gcc/x86_64-linux-gnu/11/include/ will be indexed Folder: /usr/local/include/ will be indexed Folder: /home/kappa/Arduino/libraries/coreino/include/ will be indexed Folder: /home/kappa/Arduino/libraries/coreino/build_arm/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/8.3.0/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ will be indexed Folder: /home/kappa/work/firmware/owasys/owaino/repo/ will be indexed cpptools/didChangeCppProperties Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c++17 -Wp,-v -E -dM -x c++ -m64 /dev/null terminating child process: 35573 Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c17 -Wp,-v -E -dM -x c -m64 /dev/null terminating child process: 35576 Folder: /usr/include/ will be indexed Folder: /usr/lib/gcc/x86_64-linux-gnu/11/include/ will be indexed Folder: /usr/local/include/ will be indexed Folder: /home/kappa/work/firmware/owasys/owaino/repo/include/ will be indexed Folder: /home/kappa/work/firmware/owasys/owaino/repo/build_arm/ will be indexed Folder: /home/kappa/Arduino/libraries/coreino/include/ will be indexed Folder: /home/kappa/Arduino/libraries/coreino/build_arm/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/8.3.0/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ will be indexed Folder: /home/kappa/work/firmware/owasys/owasys-apps/repo/ will be indexed cpptools/didChangeCppProperties Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c++17 -Wp,-v -E -dM -x c++ -m64 /dev/null terminating child process: 35578 Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c17 -Wp,-v -E -dM -x c -m64 /dev/null terminating child process: 35580 Folder: /usr/include/ will be indexed Folder: /usr/lib/gcc/x86_64-linux-gnu/11/include/ will be indexed Folder: /usr/local/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/8.3.0/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/ will be indexed Folder: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ will be indexed Folder: /home/kappa/work/firmware/owasys/owasys-examples/repo/ will be indexed cpptools/didChangeCppProperties Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=gnu++17 -Wp,-v -E -dM -x c++ -m64 /dev/null terminating child process: 35582 Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=gnu17 -Wp,-v -E -dM -x c -m64 /dev/null terminating child process: 35584 Folder: /usr/include/ will be indexed Folder: /usr/lib/gcc/x86_64-linux-gnu/11/include/ will be indexed Folder: /usr/local/include/ will be indexed Folder: /home/kappa/open-kappa/cpp/mycmake/repo/ will be indexed cpptools/didChangeCppProperties Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c++20 -Wp,-v -E -dM -x c++ -m64 /dev/null terminating child process: 35586 Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=c17 -Wp,-v -E -dM -x c -m64 /dev/null terminating child process: 35588 Folder: /usr/include/ will be indexed Folder: /usr/lib/gcc/x86_64-linux-gnu/11/include/ will be indexed Folder: /usr/local/include/ will be indexed Folder: /home/kappa/.config/Code/User/ will be indexed cpptools/didChangeCppProperties Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=gnu17 -Wp,-v -E -dM -x c -m64 /dev/null terminating child process: 35590 Code browsing service initialized Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/gcc' Compiler query command line: "/usr/bin/gcc" -std=gnu++17 -Wp,-v -E -dM -x c++ -m64 /dev/null terminating child process: 35593 Folder: /usr/include/ will be indexed Folder: /usr/lib/gcc/x86_64-linux-gnu/11/include/ will be indexed Folder: /usr/local/include/ will be indexed Folder: /home/kappa/vscode-workspaces/ will be indexed textDocument/didOpen: /home/kappa/Arduino/libraries/coreino/src/coreino.h Discovering files... Processing folder (recursive): /usr/include/ Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/textEditorSelectionChange cpptools/activeDocumentChange: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/getDocumentSymbols: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 2) cpptools/getFoldingRanges: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 3) cpptools/getSemanticTokens: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 4) cpptools/getDocumentSymbols cpptools/fileCreated: /home/kappa/.config/Code/User/workspaceStorage/da06186a1bcb1f72b357c626851e5d26/ms-vscode.cpptools/COREINO/.browse.VC.db-shm cpptools/fileCreated: /home/kappa/.config/Code/User/workspaceStorage/da06186a1bcb1f72b357c626851e5d26/ms-vscode.cpptools/COREINO/.browse.VC.db-wal Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/11/include/ Processing folder (recursive): /usr/local/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/8.3.0/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ terminating child process: 35595 Processing folder (recursive): /home/kappa/Arduino/libraries/coreino/ Processing folder (recursive): /usr/include/ Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/11/include/ Processing folder (recursive): /usr/local/include/ Processing folder (recursive): /home/kappa/Arduino/libraries/coreino/include/ Processing folder (recursive): /home/kappa/Arduino/libraries/coreino/build_arm/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/8.3.0/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ Processing folder (recursive): /home/kappa/work/firmware/owasys/owaino/repo/ Processing folder (recursive): /usr/include/ Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/11/include/ Processing folder (recursive): /usr/local/include/ Processing folder (recursive): /home/kappa/work/firmware/owasys/owaino/repo/include/ Processing folder (recursive): /home/kappa/work/firmware/owasys/owaino/repo/build_arm/ Processing folder (recursive): /home/kappa/Arduino/libraries/coreino/include/ Processing folder (recursive): /home/kappa/Arduino/libraries/coreino/build_arm/ terminating child process: 35597 sending compilation args for /home/kappa/Arduino/libraries/coreino/src/coreino.h include: /home/kappa/Arduino/libraries/coreino/build_arm include: /home/kappa/Arduino/libraries/coreino/build_arm/_deps/json-src/include/nlohmann include: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/8.3.0/include include: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include include: /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0 include: /usr/include/c++/11 include: /usr/include/x86_64-linux-gnu/c++/11 include: /usr/include/c++/11/backward include: /usr/lib/gcc/x86_64-linux-gnu/11/include include: /usr/local/include include: /usr/include/x86_64-linux-gnu include: /usr/include define: DBL_MIN_EXP=(-1021) define: UINT_LEAST16_MAX=0xffff define: ATOMIC_ACQUIRE=2 define: __FLT128_MAX_10_EXP=4932 define: FLT_MIN=1.17549435082228750796873653722224568e-38F define: GCC_IEC_559_COMPLEX=2 define: UINT_LEAST8_TYPE=unsigned char define: SIZEOF_FLOAT80=16 define: INTMAX_C(c)=c ## L define: CHAR_BIT=8 define: UINT8_MAX=0xff define: SCHAR_WIDTH=8 define: WINT_MAX=0xffffffffU define: FLT32_MIN_EXP=(-125) define: ORDER_LITTLE_ENDIAN=1234 define: SIZE_MAX=0xffffffffffffffffUL define: WCHAR_MAX=0x7fffffff 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: DBL_DENORM_MIN=double(4.94065645841246544176568792868221372e-324L) define: GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1 define: GCC_ATOMIC_CHAR_LOCK_FREE=2 define: GCC_IEC_559=2 define: FLT32X_DECIMAL_DIG=17 define: FLT_EVAL_METHOD=0 define: FLT64_DECIMAL_DIG=17 define: GCC_ATOMIC_CHAR32_T_LOCK_FREE=2 define: UINT_FAST64_MAX=0xffffffffffffffffUL define: SIG_ATOMIC_TYPE=int define: __DBL_MIN_10_EXP=(-307) define: FINITE_MATH_ONLY=0 define: FLT32X_MAX_EXP=1024 define: FLT32_HAS_DENORM=1 define: UINT_FAST8_MAX=0xff define: DEC64_MAX_EXP=385 define: INT8_C(c)=c define: INT_LEAST8_WIDTH=8 define: UINT_LEAST64_MAX=0xffffffffffffffffUL define: INT_LEAST8_MAX=0x7f define: __SHRT_MAX=0x7fff define: LDBL_MAX=1.18973149535723176502126385303097021e+4932L define: FLT64X_MAX_10_EXP=4932 define: LDBL_IS_IEC_60559=2 define: FLT64X_HAS_QUIET_NAN=1 define: UINT_LEAST8_MAX=0xff define: GCC_ATOMIC_BOOL_LOCK_FREE=2 define: FLT128_DENORM_MIN=6.47517511943802511092443895822764655e-4966F128 define: UINTMAX_TYPE=long unsigned int define: linux=1 define: DEC32_EPSILON=1E-6DF define: FLT_EVAL_METHOD_TS_18661_3=0 define: unix=1 define: UINT32_MAX=0xffffffffU define: GXX_EXPERIMENTAL_CXX0X=1 define: FLT128_MIN_EXP=(-16381) define: WINT_MIN=0U define: FLT128_MIN_10_EXP=(-4931) define: FLT32X_IS_IEC_60559=2 define: INT_LEAST16_WIDTH=16 define: SCHAR_MAX=0x7f define: FLT128_MANT_DIG=113 define: WCHAR_MIN=(-WCHAR_MAX - 1) define: INT64_C(c)=c ## L define: GCC_ATOMIC_POINTER_LOCK_FREE=2 define: FLT32X_MANT_DIG=53 define: GCC_ATOMIC_CHAR16_T_LOCK_FREE=2 define: USER_LABEL_PREFIX= define: FLT32_MAX_10_EXP=38 define: FLT64X_EPSILON=1.08420217248550443400745280086994171e-19F64x define: STDC_HOSTED=1 define: DEC64_MIN_EXP=(-382) define: DBL_DIG=15 define: FLT32_DIG=6 define: FLT_EPSILON=1.19209289550781250000000000000000000e-7F define: GXX_WEAK=1 define: SHRT_WIDTH=16 define: FLT32_IS_IEC_60559=2 define: LDBL_MIN=3.36210314311209350626267781732175260e-4932L define: DBL_IS_IEC_60559=2 define: DEC32_MAX=9.999999E96DF define: FLT64X_DENORM_MIN=3.64519953188247460252840593361941982e-4951F64x define: FLT32X_HAS_INFINITY=1 define: INT32_MAX=0x7fffffff define: unix=1 define: INT_WIDTH=32 define: SIZEOF_LONG=8 define: STDC_IEC_559=1 define: STDC_ISO_10646=201706L define: UINT16_C(c)=c define: DECIMAL_DIG=21 define: STDC_IEC_559_COMPLEX=1 define: FLT64_EPSILON=2.22044604925031308084726333618164062e-16F64 define: gnu_linux=1 define: INT16_MAX=0x7fff define: FLT64_MIN_EXP=(-1021) define: FLT64X_MIN_10_EXP=(-4931) define: LDBL_HAS_QUIET_NAN=1 define: FLT64_MANT_DIG=53 define: FLT64X_MANT_DIG=64 define: GNUC=11 define: GXX_RTTI=1 define: pie=2 define: MMX=1 define: FLT_HAS_DENORM=1 define: SIZEOF_LONG_DOUBLE=16 define: BIGGEST_ALIGNMENT=16 define: STDC_UTF_16=1 define: FLT64_MAX_10_EXP=308 define: FLT32_HAS_INFINITY=1 define: DBL_MAX=double(1.79769313486231570814527423731704357e+308L) define: INT_FAST32_MAX=0x7fffffffffffffffL define: DBL_HAS_INFINITY=1 define: SIZEOF_FLOAT=4 define: HAVE_SPECULATION_SAFE_VALUE=1 define: DEC32_MIN_EXP=(-94) define: __INTPTR_WIDTH=64 define: FLT64X_HAS_INFINITY=1 define: UINT_LEAST32_MAX=0xffffffffU define: FLT32X_HAS_DENORM=1 define: INT_FAST16_TYPE=long int define: STRICT_ANSI=1 define: MMX_WITH_SSE=1 define: LDBL_HAS_DENORM=1 define: cplusplus=201703L define: __DEC32_MIN=1E-95DF define: DEPRECATED=1 define: DBL_MAX_EXP=1024 define: WCHAR_WIDTH=32 define: FLT32_MAX=3.40282346638528859811704183484516925e+38F32 define: DEC128_EPSILON=1E-33DL define: SSE2_MATH=1 define: ATOMIC_HLE_RELEASE=131072 define: PTRDIFF_MAX=0x7fffffffffffffffL define: amd64=1 define: ATOMIC_HLE_ACQUIRE=65536 define: GNUG=11 define: LONG_LONG_MAX=0x7fffffffffffffffLL define: SIZEOF_SIZE_T=8 define: FLT64X_MIN_EXP=(-16381) define: SIZEOF_WINT_T=4 define: LONG_LONG_WIDTH=64 define: FLT32_MAX_EXP=128 define: GXX_ABI_VERSION=1016 define: FLT128_HAS_INFINITY=1 define: FLT_MIN_EXP=(-125) define: GCC_HAVE_DWARF2_CFI_ASM=1 define: x86_64=1 define: INT_FAST64_TYPE=long int define: FLT64_DENORM_MIN=4.94065645841246544176568792868221372e-324F64 define: DBL_MIN=double(2.22507385850720138309023271733240406e-308L) define: FLT128_EPSILON=1.92592994438723585305597794258492732e-34F128 define: FLT64X_NORM_MAX=1.18973149535723176502126385303097021e+4932F64x define: SIZEOF_POINTER=8 define: LP64=1 define: DBL_HAS_QUIET_NAN=1 define: FLT32X_EPSILON=2.22044604925031308084726333618164062e-16F32x define: DECIMAL_BID_FORMAT=1 define: FLT64_MIN_10_EXP=(-307) define: FLT64X_DECIMAL_DIG=21 define: DEC128_MIN=1E-6143DL define: REGISTER_PREFIX= define: UINT16_MAX=0xffff define: LDBL_HAS_INFINITY=1 define: FLT32_MIN=1.17549435082228750796873653722224568e-38F32 define: UINT8_TYPE=unsigned char define: FLT_DIG=6 define: NO_INLINE=1 define: DEC_EVAL_METHOD=2 define: DEC128_MAX=9.999999999999999999999999999999999E6144DL define: FLT_MANT_DIG=24 define: LDBL_DECIMAL_DIG=21 define: VERSION="11.2.0" define: UINT64_C(c)=c ## UL define: _STDC_PREDEF_H=1 define: INT_LEAST32_MAX=0x7fffffff define: GCC_ATOMIC_INT_LOCK_FREE=2 define: FLT128_MAX_EXP=16384 define: FLT32_MANT_DIG=24 define: FLOAT_WORD_ORDER=ORDER_LITTLE_ENDIAN define: FLT128_HAS_DENORM=1 define: FLT32_DECIMAL_DIG=9 define: FLT128_DIG=33 define: INT32_C(c)=c define: DEC64_EPSILON=1E-15DD define: ORDER_PDP_ENDIAN=3412 define: DEC128_MIN_EXP=(-6142) define: INT_FAST32_TYPE=long int define: UINT_LEAST16_TYPE=short unsigned int define: DBL_HAS_DENORM=1 define: SIZE_TYPE=long unsigned int define: UINT64_MAX=0xffffffffffffffffUL define: FLT_IS_IEC_60559=2 define: GNUC_WIDE_EXECUTION_CHARSET_NAME="UTF-32LE" define: FLT64X_DIG=18 define: INT8_TYPE=signed char define: ELF=1 define: GCC_ASM_FLAG_OUTPUTS=1 define: UINT32_TYPE=unsigned int define: FLT_RADIX=2 define: INT_LEAST16_TYPE=short int define: LDBL_EPSILON=1.08420217248550443400745280086994171e-19L define: UINTMAX_C(c)=c ## UL define: k8=1 define: FLT32X_MIN=2.22507385850720138309023271733240406e-308F32x define: SIG_ATOMIC_MAX=0x7fffffff define: GCC_ATOMIC_WCHAR_T_LOCK_FREE=2 define: SIZEOF_PTRDIFF_T=8 define: LDBL_DIG=18 define: FLT64_IS_IEC_60559=2 define: x86_64=1 define: FLT32X_MIN_EXP=(-1021) define: DEC32_SUBNORMAL_MIN=0.000001E-95DF define: INT_FAST16_MAX=0x7fffffffffffffffL define: FLT64_DIG=15 define: UINT_FAST32_MAX=0xffffffffffffffffUL define: UINT_LEAST64_TYPE=long unsigned int define: FLT_HAS_QUIET_NAN=1 define: FLT_MAX_10_EXP=38 define: LONG_MAX=0x7fffffffffffffffL define: FLT64X_HAS_DENORM=1 define: DEC128_SUBNORMAL_MIN=0.000000000000000000000000000000001E-6143DL define: FLT_HAS_INFINITY=1 define: GNUC_EXECUTION_CHARSET_NAME="UTF-8" define: UINT_FAST16_TYPE=long unsigned int define: DEC64_MAX=9.999999999999999E384DD define: INT_FAST32_WIDTH=64 define: CHAR16_TYPE=short unsigned int define: PRAGMA_REDEFINE_EXTNAME=1 define: SIZE_WIDTH=64 define: SEG_FS=1 define: INT_LEAST16_MAX=0x7fff define: DEC64_MANT_DIG=16 define: INT64_MAX=0x7fffffffffffffffL define: SEG_GS=1 define: FLT32_DENORM_MIN=1.40129846432481707092372958328991613e-45F32 define: SIG_ATOMIC_WIDTH=32 define: INT_LEAST64_TYPE=long int define: INT16_TYPE=short int define: INT_LEAST8_TYPE=signed char define: SIZEOF_INT=4 define: DEC32_MAX_EXP=97 define: INT_FAST8_MAX=0x7f define: FLT128_MAX=1.18973149535723176508575932662800702e+4932F128 define: INTPTR_MAX=0x7fffffffffffffffL define: FLT64_HAS_QUIET_NAN=1 define: FLT32_MIN_10_EXP=(-37) define: EXCEPTIONS=1 define: PTRDIFF_WIDTH=64 define: LDBL_MANT_DIG=64 define: FLT64_HAS_INFINITY=1 define: FLT64X_MAX=1.18973149535723176502126385303097021e+4932F64x define: STDCPP_DEFAULT_NEW_ALIGNMENT=16 define: SIG_ATOMIC_MIN=(-SIG_ATOMIC_MAX - 1) define: code_model_small=1 define: GCC_ATOMIC_LONG_LOCK_FREE=2 define: DEC32_MANT_DIG=7 define: k8=1 define: INTPTR_TYPE=long int define: UINT16_TYPE=short unsigned int define: WCHAR_TYPE=int define: pic=2 define: UINTPTR_MAX=0xffffffffffffffffUL define: INT_FAST64_WIDTH=64 define: INT_FAST64_MAX=0x7fffffffffffffffL define: GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1 define: FLT_NORM_MAX=3.40282346638528859811704183484516925e+38F define: FLT64X_MAX_EXP=16384 define: UINT_FAST64_TYPE=long unsigned int define: __INT_MAX=0x7fffffff define: linux=1 define: INT64_TYPE=long int define: FLT_MAX_EXP=128 define: ORDER_BIG_ENDIAN=4321 define: DBL_MANT_DIG=53 define: SIZEOF_FLOAT128=16 define: INT_LEAST64_MAX=0x7fffffffffffffffL define: DEC64_MIN=1E-383DD define: WINT_TYPE=unsigned int define: UINT_LEAST32_TYPE=unsigned int define: SIZEOF_SHORT=2 define: FLT32_NORM_MAX=3.40282346638528859811704183484516925e+38F32 define: SSE=1 define: LDBL_MIN_EXP=(-16381) define: FLT64_MAX=1.79769313486231570814527423731704357e+308F64 define: amd64=1 define: WINT_WIDTH=32 define: INT_LEAST64_WIDTH=64 define: LDBL_MAX_EXP=16384 define: FLT32X_MAX_10_EXP=308 define: SIZEOF_INT128=16 define: FLT64X_IS_IEC_60559=2 define: LDBL_MAX_10_EXP=4932 define: ATOMIC_RELAXED=0 define: DBL_EPSILON=double(2.22044604925031308084726333618164062e-16L) define: FLT128_MIN=3.36210314311209350626267781732175260e-4932F128 define: _LP64=1 define: __UINT8_C(c)=c define: FLT64_MAX_EXP=1024 define: INT_LEAST32_TYPE=int define: SIZEOF_WCHAR_T=4 define: GNUC_PATCHLEVEL=0 define: FLT128_NORM_MAX=1.18973149535723176508575932662800702e+4932F128 define: FLT64_NORM_MAX=1.79769313486231570814527423731704357e+308F64 define: FLT128_HAS_QUIET_NAN=1 define: INTMAX_MAX=0x7fffffffffffffffL define: INT_FAST8_TYPE=signed char define: FLT64X_MIN=3.36210314311209350626267781732175260e-4932F64x define: STDCPP_THREADS=1 define: GNUC_STDC_INLINE=1 define: FLT64_HAS_DENORM=1 define: FLT32_EPSILON=1.19209289550781250000000000000000000e-7F32 define: DBL_DECIMAL_DIG=17 define: STDC_UTF_32=1 define: INT_FAST8_WIDTH=8 define: FXSR=1 define: FLT32X_MAX=1.79769313486231570814527423731704357e+308F32x define: DBL_NORM_MAX=double(1.79769313486231570814527423731704357e+308L) define: BYTE_ORDER=ORDER_LITTLE_ENDIAN define: INTMAX_WIDTH=64 define: UINT64_TYPE=long unsigned int define: UINT32_C(c)=c ## U define: FLT_DENORM_MIN=1.40129846432481707092372958328991613e-45F define: FLT128_IS_IEC_60559=2 define: INT8_MAX=0x7f define: LONG_WIDTH=64 define: PIC=2 define: UINT_FAST32_TYPE=long unsigned int define: FLT32X_NORM_MAX=1.79769313486231570814527423731704357e+308F32x define: CHAR32_TYPE=unsigned int define: FLT_MAX=3.40282346638528859811704183484516925e+38F define: SSE2=1 define: INT32_TYPE=int define: SIZEOF_DOUBLE=8 define: FLT_MIN_10_EXP=(-37) define: FLT64_MIN=2.22507385850720138309023271733240406e-308F64 define: INT_LEAST32_WIDTH=32 define: INTMAX_TYPE=long int define: DEC128_MAX_EXP=6145 define: FLT32X_HAS_QUIET_NAN=1 define: ATOMIC_CONSUME=1 define: GNUC_MINOR=2 define: INT_FAST16_WIDTH=64 define: UINTMAX_MAX=0xffffffffffffffffUL define: PIE=2 define: FLT32X_DENORM_MIN=4.94065645841246544176568792868221372e-324F32x define: DBL_MAX_10_EXP=308 define: LDBL_DENORM_MIN=3.64519953188247460252840593361941982e-4951L define: INT16_C(c)=c define: STDC=1 define: FLT32X_DIG=15 define: PTRDIFF_TYPE=long int define: ATOMIC_SEQ_CST=5 define: FLT32X_MIN_10_EXP=(-307) define: UINTPTR_TYPE=long unsigned int define: DEC64_SUBNORMAL_MIN=0.000000000000001E-383DD define: DEC128_MANT_DIG=34 define: LDBL_MIN_10_EXP=(-4931) define: SSE_MATH=1 define: SIZEOF_LONG_LONG=8 define: FLT128_DECIMAL_DIG=36 define: GCC_ATOMIC_LLONG_LOCK_FREE=2 define: FLT32_HAS_QUIET_NAN=1 define: FLT_DECIMAL_DIG=9 define: UINT_FAST16_MAX=0xffffffffffffffffUL define: LDBL_NORM_MAX=1.18973149535723176502126385303097021e+4932L define: GCC_ATOMIC_SHORT_LOCK_FREE=2 define: UINT_FAST8_TYPE=unsigned char define: _GNU_SOURCE=1 define: ATOMIC_ACQ_REL=4 define: ATOMIC_RELEASE=3 define: COREINO_NO_EXPORT define: ARM_PCS_VFP define: RTC_DATA_ATTR= other: --g++ other: --gnu_version=110200 other: --header_only_fallback stdver: c++17 intelliSenseMode: linux-gcc-x64 Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/8.3.0/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ Processing folder (recursive): /home/kappa/work/firmware/owasys/owasys-apps/repo/ Processing folder (recursive): /usr/include/ Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/11/include/ Processing folder (recursive): /usr/local/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/lib/gcc/arm-linux-gnueabihf/8.3.0/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/ Processing folder (recursive): /opt/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/8.3.0/ Processing folder (recursive): /home/kappa/work/firmware/owasys/owasys-examples/repo/ Processing folder (recursive): /usr/include/ Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/11/include/ Processing folder (recursive): /usr/local/include/ Processing folder (recursive): /home/kappa/open-kappa/cpp/mycmake/repo/ Processing folder (recursive): /usr/include/ Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/11/include/ Processing folder (recursive): /usr/local/include/ Processing folder (recursive): /home/kappa/.config/Code/User/ Processing folder (recursive): /usr/include/ Processing folder (recursive): /usr/lib/gcc/x86_64-linux-gnu/11/include/ Processing folder (recursive): /usr/local/include/ Processing folder (recursive): /home/kappa/vscode-workspaces/ Discovering files: 30126 file(s) processed 0 file(s) removed from database Done discovering files. Parsing open files... Populating include completion cache. Done parsing open files. Parsing remaining files... Parsing: 0 files(s) processed Done parsing remaining files. terminating child process: 35619 terminating child process: 35621 cpptools/finishUpdateSquiggles Error squiggle count: 1 Tag Parser will be used for IntelliSense operations in: file:///home/kappa/Arduino/libraries/coreino/src/coreino.h terminating child process: 35625 Update IntelliSense time (sec): 1.477 cpptools/getFoldingRanges: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 5) cpptools/fileDeleted: /home/kappa/.config/Code/User/workspaceStorage/1646121060715 Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/finishUpdateSquiggles Error squiggle count: 1 Update IntelliSense time (sec): 0.474 cpptools/getSemanticTokens: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 6) cpptools/getFoldingRanges: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 7) cpptools/fileChanged: /home/kappa/.config/Code/User/clipboard.history.json Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/fileChanged: /home/kappa/.config/Code/User/clipboard.history.json Database safe to open Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/finishUpdateSquiggles Error squiggle count: 1 Update IntelliSense time (sec): 1.135 cpptools/getSemanticTokens: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 8) cpptools/getFoldingRanges: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 9) cpptools/fileChanged: /home/kappa/.config/Code/User/clipboard.history.json Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/fileChanged: /home/kappa/.config/Code/User/clipboard.history.json Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/finishUpdateSquiggles Error squiggle count: 1 Update IntelliSense time (sec): 0.975 cpptools/getSemanticTokens: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 10) cpptools/getFoldingRanges: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 11) cpptools/fileChanged: /home/kappa/.config/Code/User/clipboard.history.json Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/fileChanged: /home/kappa/.config/Code/User/clipboard.history.json Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/finishUpdateSquiggles Error squiggle count: 1 Update IntelliSense time (sec): 0.928 cpptools/getSemanticTokens: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 12) cpptools/getFoldingRanges: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 13) cpptools/fileChanged: /home/kappa/.config/Code/User/clipboard.history.json Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/fileChanged: /home/kappa/.config/Code/User/clipboard.history.json Checking for syntax errors: /home/kappa/Arduino/libraries/coreino/src/coreino.h Queueing IntelliSense update for files in translation unit of: /home/kappa/Arduino/libraries/coreino/src/coreino.h cpptools/finishUpdateSquiggles Error squiggle count: 1 Update IntelliSense time (sec): 0.964 cpptools/getSemanticTokens: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 14) cpptools/getFoldingRanges: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 15) textDocument/hover: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 16) using Tag Parser for quick info cpptools/getCodeActions: /home/kappa/Arduino/libraries/coreino/src/coreino.h (id: 17) 0 include path suggestion(s) discovered.



**Screenshots**
<!-- If applicable, add screenshots to help explain your problem. -->

**Additional context**
<!--
Providing call stacks:
For bugs like crashes, deadlocks, infinite loops, etc. that we are not able to repro and for which the call stack may be useful, please attach a debugger and/or create a dmp and provide the call stacks. Windows binaries have symbols available in VS Code by setting your "symbolSearchPath" to "https://msdl.microsoft.com/download/symbols".

Instructions for attaching debugger to language service process:
https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv.

Performance analysis:
For a performance issue see instructions at https://github.com/microsoft/vscode-cpptools/wiki/Troubleshooting-Performance-Issues.
-->
FStefanni commented 2 years ago

Hi,

finally I have been able to fix the issue. There was actually a wrong include in another file. Something as:

#include <json.hpp>

And the path to that file i nthe config, while it should have been:

#include <lib/json.hpp>

And the path accordingly with this (i.e. a directory shorter). In fact inside the json.hpp there are includes like this (which is quite strange, but fine/legal):

#include <lib/jsonParser.hpp>
#include <lib/jsonEncoder.hpp>
...

So everything is fixed now.

Nevertheless, the issue remains: the error message is useless to fix this issue. If the error was clearly stated, it would have taken few seconds instead of hours to fix. Something as the following would be nice (feel free to change/improve it):

In file <full path to the file>, line <line number of error>: cannot find <the unresolved included file>

Also, reporting the error only where it happens, i.e. where I was including json.hpp would be better, and possible "tag parsing" fallback should be applied only to files with the wrong include (in my case it was in a completely unrelated header).

Regards

Ben-Voris commented 2 years ago

I've encountered something like this on ms-vscode.cpptools Version 1.9.2 (insiders3): March 1, 2022.

This picture shows the red squiggly pointing to the # of the #ifdef.

vs-code-cpp-wrong-include-line

Here's the error from the error pane.

[{
    "resource": "/c:/Users/BVoris/git/allocateSegments/include/parseNbr.hpp",
    "owner": "C/C++",
    "code": "1696",
    "severity": 8,
    "message": "#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\\Users\\BVoris\\git\\allocateSegments\\include\\parseNbr.hpp).",
    "source": "C/C++",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 1
}]

I can open all of the include files in this file with "Go to Definition". A similar problem points to an actual include, but again, "Go to Definition" opens the file.

Even more confusing, sometimes the error (again with "startLineNumber": 1, "startColumn": 1, "endLineNumber": 1, "endColumn": 1) points to a comment.

I can easily believe that somewhere in the various headers, there's something that ms-vscode.cpptools doesn't like, but this error gives no clue as to what it might be.

[{
    "resource": "/c:/Users/BVoris/git/allocateSegments/src/buildErrString.cpp",
    "owner": "C/C++",
    "code": "1696",
    "severity": 8,
    "message": "#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (C:\\Users\\BVoris\\git\\allocateSegments\\src\\buildErrString.cpp).",
    "source": "C/C++",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 20
}]

The C++ debug log:

loggingLevel: Debug
loggingLevel has changed to: Debug
cpptools/didChangeCppProperties
$/setTraceNotification
cpptools/getCodeActions: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 17)
textDocument/didOpen: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp
Checking for syntax errors: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp
cpptools/textEditorSelectionChange
cpptools/getDocumentSymbols: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 18)
cpptools/getDocumentSymbols
cpptools/textEditorSelectionChange
cpptools/getSemanticTokens: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 19)
cpptools/activeDocumentChange: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp
cpptools/getFoldingRanges: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 20)
sending compilation args for C:\Users\BVoris\git\allocateSegments\src\allocateSegments.cpp
  include: C:\USERS\BVORIS\GIT\RVU-FILES\L19.08\INCLUDE
  include: C:\ETK\L19.08\USR\INCLUDE
  include: C:\USERS\BVORIS\GIT\ALLOCATESEGMENTS\INCLUDE
  define: NONSTOPOSVERSION=L19.08
  define: _TANDEM_ARCH_=3
  define: _OSS_TARGET=1
  define _TNS_X_TARGET=1
  define: _WIN32_HOST=1
  define: __XMEM=1
  define: __INT32
  define: __CPLUSPLUS_VERSION=3
  define: _TANDEM_EXTENSIONS=1
  define: _TANDEM_SOURCE=1
  define: _alias(n)=
  define: _arg_present(n)=1
  define: _baddr=
  define: _bitlength(n)=1
  define: _c=
  define: _callable=
  define: _cc_status
  define: _cobol=
  define: _cspace=
  define: _extensible=
  define: _far=
  define: _fortran=
  define: _lowmem=
  define: _near=
  define: _optional(ex1,ex2)=1
  define: _pascal=
  define: _priv=
  define: _procaddr
  define: _ptr32=
  define: _ptr64=
  define: _resident=
  define: _tal=
  define: _variable=
  define: _waddr=
  define: GIT_VERSION="Keep VScode happy"
  preinclude: C:/Users/BVoris/git/allocateSegments/.vscode/suppress-warnings.h
  other: --clang
  other: --clang_version=110000
  stdver: c++03
  intelliSenseMode: windows-clang-x86
Queueing IntelliSense update for files in translation unit of: C:\Users\BVoris\git\allocateSegments\src\allocateSegments.cpp
cpptools/finishUpdateSquiggles
Error squiggle count: 1
Checking for syntax errors: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp
Shutting down IntelliSense server: C:\Users\BVoris\git\allocateSegments\src\allocateSegments.cpp
sending compilation args for C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp
  include: C:\USERS\BVORIS\GIT\RVU-FILES\L19.08\INCLUDE
  include: C:\ETK\L19.08\USR\INCLUDE
  include: C:\USERS\BVORIS\GIT\ALLOCATESEGMENTS\INCLUDE
  define: NONSTOPOSVERSION=L19.08
  define: _TANDEM_ARCH_=3
  define: _OSS_TARGET=1
  define: _GUARDIAN_TARGET=1
  define: _WIN32_HOST=1
  define: __XMEM=1
  define: __INT32
  define: __CPLUSPLUS_VERSION=3
  define: _TANDEM_EXTENSIONS=1
  define: _TANDEM_SOURCE=1
  define: _alias(n)=
  define: _arg_present(n)=1
  define: _baddr=
  define: _bitlength(n)=1
  define: _c=
  define: _callable=
  define: _cc_status
  define: _cobol=
  define: _cspace=
  define: _extensible=
  define: _far=
  define: _fortran=
  define: _lowmem=
  define: _near=
  define: _optional(ex1,ex2)=1
  define: _pascal=
  define: _priv=
  define: _procaddr
  define: _ptr32=
  define: _ptr64=
  define: _resident=
  define: _tal=
  define: _variable=
  define: _waddr=
  define: GIT_VERSION="Keep VScode happy"
  preinclude: C:/Users/BVoris/git/allocateSegments/.vscode/suppress-warnings.h
  other: --clang
  other: --clang_version=110000
  other: --header_only_fallback
  stdver: c++03
  intelliSenseMode: windows-clang-x86
Queueing IntelliSense update for files in translation unit of: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp
textDocument/hover: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 21)
cpptools/textEditorSelectionChange
cpptools/getCodeActions: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 22)
cpptools/finishUpdateSquiggles
Error squiggle count: 2
Error squiggles will be disabled in: file:///C%3A/Users/BVoris/git/allocateSegments/include/parseNbr.hpp
Update IntelliSense time (sec): 16.022
cpptools/getFoldingRanges: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 23)
cpptools/getCodeActions: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 24)
textDocument/hover: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 25)
Quick info operation failed: FE: 'Unknown error'
using Tag Parser for quick info
cpptools/getCodeActions: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp (id: 26)
cpptools/textEditorSelectionChange
cpptools/activeDocumentChange: C:\Users\BVoris\git\allocateSegments\include\parseNbr.hpp