Vscode-cpptools: IntelliSense mark a lot of the standard functions with red

Created on 11 Oct 2018  路  12Comments  路  Source: microsoft/vscode-cpptools

Type: LanguageService

Describe the bug

  • OS and Version: Windows 10
  • VS Code Version: 1.28.0
  • C/C++ Extension Version: 0.19.0
  • Other extensions you installed (and if the issue persists after disabling them): ms-python.python and robertohuertasm.vscode-icons. the issue persist if I disabe them
  • I have all of the include paths reported by my compiler (g++) in the include path, and still my file is filled with red lines.
    compiler reports:
> Using built-in specs.
COLLECT_GCC=C:\mingw\bin\g++.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-8.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=ada,c,lto,c++,objc,obj-c++,fortran --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release--disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev3, Built byMSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 8.2.0 (Rev3, Built by MSYS2 project)
COLLECT_GCC_OPTIONS='-v' '-E' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/cc1plus.exe -E -quiet -v -iprefix C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/ -D_REENTRANT - -mtune=generic -march=x86-64
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../include/c++/8.2.0"
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../include/c++/8.2.0/x86_64-w64-mingw32"
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../include/c++/8.2.0/backward"
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.2.0/include"
ignoring nonexistent directory "F:/msys64/mingw64/include"
ignoring nonexistent directory "/mingw64/include"
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed"
ignoring duplicate directory "C:/mingw/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "F:/msys64/mingw64/x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../include/c++/8.2.0
 C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../include/c++/8.2.0/x86_64-w64-mingw32
 C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../include/c++/8.2.0/backward
 C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/include
 C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../include
 C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed
 C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/include
End of search list.
COMPILER_PATH=C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/;C:/mingw/bin/../lib/gcc/;C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/;C:/mingw/bin/../lib/gcc/;C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/lib/../lib/;C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../lib/;C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/lib/;C:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../
COLLECT_GCC_OPTIONS='-v' '-E' '-shared-libgcc' '-mtune=generic' '-march=x86-64'

my c_cpp_properties.json:
`` {
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}",
"C:/mingw/include/c++/8.2.0",
"C:/mingw/include/c++/8.2.0/x86_64-w64-mingw32",
"C:/mingw/include/c++/8.2.0/backward",
"C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include",
"C:/mingw/include",
"C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed",
"C:/mingw/x86_64-w64-mingw32/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"intelliSenseMode": "clang-x64",
"compilerPath": "C:/msys64/mingw64/bin/g++.exe",
"browse": {
"path": [
"${workspaceFolder}",
"C:/mingw/include/c++/8.2.0",
"C:/mingw/include/c++/8.2.0/x86_64-w64-mingw32",
"C:/mingw/include/c++/8.2.0/backward",
"C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include",
"C:/mingw/include",
"C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed",
"C:/mingw/x86_64-w64-mingw32/include"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
````

my file:
fff

Language Service bug more info needed

All 12 comments

For some reason, if I re-saved the c_cpp_properties.json file, even without making any changes, all of that red squiggly lines go away.

We had some bugs with squiggles not updating correctly. https://github.com/Microsoft/vscode-cpptools/releases/download/0.19.1-insiders/cpptools-win32.vsix may have fixed the issue.

unfortunately it didn't

So you're still getting incorrect squiggles? Can you set your C_Cpp.loggingLevel to "Debug" and check if the g++.exe compiler is getting queried correctly? It sounds like the compiler defines might not be getting set correctly.

How to check if the compiler is queried correctly?

@AEM5299 you should enable debug logging, reload the window and then take a look at the logs in the Output window. You can also share the output here if you are unable to find the relevant section.

OS and Version: Windows 10
VS Code Version: 1.28.2
C/C++ Extension Version: 0.19.0

I have this problem,too

my c_cpp_properties.json:

{
    "env": {
        "myDefaultIncludePath": [
            "${workspaceFolder}",
            "${workspaceFolder}/include"
        ],
        "myCompilerPath": "D:/Compiler/MinGW",
        "myCppIncludePath": "${myCompilerPath}/lib/gcc/mingw32/6.3.0/include/c++"
    },
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "${myCppIncludePath}",
                "${myCppIncludePath}/mingw32",
                "${myCppIncludePath}/backward",
                "${myCompilerPath}/lib/gcc/mingw32/6.3.0/include",
                "${myCompilerPath}/include",
                "${myCompilerPath}/lib/gcc/mingw32/6.3.0/include-fixed"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "browse": {
                "path": [
                    "${workspaceFolder}",
                    "${myCppIncludePath}",
                    "${myCppIncludePath}/mingw32",
                    "${myCppIncludePath}/backward",
                    "${myCompilerPath}/lib/gcc/mingw32/6.3.0/include",
                    "${myCompilerPath}/include",
                    "${myCompilerPath}/lib/gcc/mingw32/6.3.0/include-fixed"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

vscode1

This is my debug log

initialized
workspace/didChangeConfiguration
IntelliSense Engine = Default.
The extension will use the Tag Parser for IntelliSense when #includes don't resolve.
Autocomplete is enabled.
Error squiggles are enabled.
File exclude: */.git
File exclude: *
/.svn
File exclude: */.hg
File exclude: *
/CVS
File exclude: */.DS_Store
File exclude: *
/.vscode
Search exclude: */node_modules
Search exclude: *
/bower_components
Search exclude: **/.vscode
cpptools/queryCompilerDefaults
Attempting to get defaults from compiler found on the machine: ''
Attempting to get defaults from compiler found on the machine: D:\IDE\FPC\3.0.2\bin\i386-win32\gcc.exe
cpptools/didChangeFolderSettings
Attempting to get defaults from compiler found on the machine: D:\IDE\FPC\3.0.2\bin\i386-win32\gcc.exe
Code browsing service initialized
Attempting to get defaults from compiler found on the machine: D:\IDE\FPC\3.0.2\bin\i386-win32\gcc.exe
Folder: E:/C++/ will be indexed
Folder: D:/COMPILER/MINGW/LIB/GCC/MINGW32/6.3.0/INCLUDE/ will be indexed
Folder: D:/COMPILER/MINGW/INCLUDE/ will be indexed
Folder: D:/COMPILER/MINGW/LIB/GCC/MINGW32/6.3.0/INCLUDE-FIXED/ will be indexed
Discovering files...
Processing folder (recursive): E:/C++/
Processing folder (recursive): D:/COMPILER/MINGW/LIB/GCC/MINGW32/6.3.0/INCLUDE/
Processing folder (recursive): D:/COMPILER/MINGW/INCLUDE/
Processing folder (recursive): D:/COMPILER/MINGW/LIB/GCC/MINGW32/6.3.0/INCLUDE-FIXED/
Discovering files: 1884 file(s) processed
0 file(s) removed from database
Done discovering files.
Populate include completion cache.
Parsing remaining files...
Parsing: 0 files(s) processed
Done parsing remaining files.
textDocument/codeAction
cpptools/activeDocumentChange
cpptools/textEditorSelectionChange
cpptools/textEditorSelectionChange
textDocument/documentSymbol
textDocument/didOpen
sending compilation args for E:\C++\A+B PROBLEM\2018_4.CPP
include: D:\COMPILER\MINGW\LIB\GCC\MINGW32\6.3.0\INCLUDE\C++
include: D:\COMPILER\MINGW\LIB\GCC\MINGW32\6.3.0\INCLUDE\C++\MINGW32
include: D:\COMPILER\MINGW\LIB\GCC\MINGW32\6.3.0\INCLUDE\C++\BACKWARD
include: D:\COMPILER\MINGW\LIB\GCC\MINGW32\6.3.0\INCLUDE
include: D:\COMPILER\MINGW\INCLUDE
include: D:\COMPILER\MINGW\LIB\GCC\MINGW32\6.3.0\INCLUDE-FIXED
define: _DEBUG
define: UNICODE
define: _UNICODE
stdver: --ms_c++latest
intelliSenseMode: msvc
Checking for syntax errors: file:///e%3A/C%2B%2B/A%2BB%20Problem/2018_4.cpp
queue_update_intellisense for files in tu of: E:\C++\A+B PROBLEM\2018_4.CPP
textDocument/codeAction
errorSquiggles count: 2
textDocument/codeAction

I guess it is relevant to "stdver".
And I wonder that why the intelliSenseMode is "msvc"?I have set it to "gcc-x64".
Excuse me,my English is not good.

@a2757326588, for MinGW, you should be setting the "compilerPath" property in c_cpp_properties.json or else the system defines will not be set properly. Take a look at this guide.

@bobbrow Thank you,it works.

@AEM5299 If you haven't solved this problem yet,you can try it:
c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}",
                "C:/mingw/include/c++/8.2.0",
                "C:/mingw/include/c++/8.2.0/x86_64-w64-mingw32",
                "C:/mingw/include/c++/8.2.0/backward",
                "C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include",
                "C:/mingw/include",
                "C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed",
                "C:/mingw/x86_64-w64-mingw32/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "intelliSenseMode": "gcc-x64",
            "compilerPath": "C:/msys64/mingw64/bin/g++.exe",
            "browse": {
                "path": [ 
                "${workspaceFolder}",
                "C:/mingw/include/c++/8.2.0",
                "C:/mingw/include/c++/8.2.0/x86_64-w64-mingw32",
                "C:/mingw/include/c++/8.2.0/backward",
                "C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include",
                "C:/mingw/include",
                "C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed",
                "C:/mingw/x86_64-w64-mingw32/include"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 4
}

settings.json:
"C_Cpp.default.intelliSenseMode": "gcc-x64"

@AEM5299 If you haven't solved this problem yet,you can try it:
c_cpp_properties.json

{
  "configurations": [
      {
          "name": "Win32",
          "includePath": [
              "${workspaceFolder}",
              "C:/mingw/include/c++/8.2.0",
              "C:/mingw/include/c++/8.2.0/x86_64-w64-mingw32",
              "C:/mingw/include/c++/8.2.0/backward",
              "C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include",
              "C:/mingw/include",
              "C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed",
              "C:/mingw/x86_64-w64-mingw32/include"
          ],
          "defines": [
              "_DEBUG",
              "UNICODE",
              "_UNICODE"
          ],
          "intelliSenseMode": "gcc-x64",
          "compilerPath": "C:/msys64/mingw64/bin/g++.exe",
          "browse": {
              "path": [ 
              "${workspaceFolder}",
              "C:/mingw/include/c++/8.2.0",
              "C:/mingw/include/c++/8.2.0/x86_64-w64-mingw32",
              "C:/mingw/include/c++/8.2.0/backward",
              "C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include",
              "C:/mingw/include",
              "C:/mingw/lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed",
              "C:/mingw/x86_64-w64-mingw32/include"
              ],
              "limitSymbolsToIncludedHeaders": true,
              "databaseFilename": ""
          }
      }
  ],
  "version": 4
}

settings.json:
"C_Cpp.default.intelliSenseMode": "gcc-x64"

This solved my issue. Thanks and sorry for the late reply!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jrieken picture jrieken  路  3Comments

ecbrodie picture ecbrodie  路  3Comments

jheinzel picture jheinzel  路  3Comments

montery8 picture montery8  路  3Comments

arl picture arl  路  3Comments