Vscode-cpptools: False red underline with no compilation error

Created on 28 Aug 2018  路  3Comments  路  Source: microsoft/vscode-cpptools

Issue Type: Bug

Just use this code and see the red underlines:

#include <bits/stdc++.h>
using namespace std;

int arr[(int)'z' + 1];

int main()
{
    int n,k;
    scanf("%d%d", &n, &k);

    string numberstr;
    cin>>numberstr;
}

also, here is my include path for win32:

"includePath": [
                "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/include/*",
                "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/um",
                "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/ucrt",
                "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/shared",
                "C:/Program Files (x86)/Windows Kits/10/Include/10.0.16299.0/winrt",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++",
                "${workspaceRoot}",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/mingw32",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/mingw32/bits"
            ]

Extension version: 0.18.1
VS Code version: Code 1.26.1 (493869ee8e8a846b0855873886fc79d480d342de, 2018-08-16T18:38:57.434Z)
OS version: Windows_NT x64 10.0.17134


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz (4 x 3912)|
|GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled|
|Memory (System)|3.91GB (1.29GB free)|
|Process Argv|C:\Users\thisi\AppData\Local\Programs\Microsoft VS Code\Code.exe|
|Screen Reader|no|
|VM|0%|


Language Service question

All 3 comments

Mixing includes from both MinGW and MSVC is almost certainly not what you want. I recommend removing all the system includes from your includePath and setting compilerPath to point to your MinGW compiler instead:

For example:

    "includePath" : [
        "${workspaceRoot}"
    ],
    "compilerPath": "c:/path/to/g++.exe"

If you are using MinGW, you will also want to make sure you set:

    "intelliSenseMode": "gcc-x64"

Ok, setting intellisense mode to gcc-x64 solved the problem. Thanks @bobbrow

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arl picture arl  路  3Comments

CDitzel picture CDitzel  路  3Comments

ecbrodie picture ecbrodie  路  3Comments

jyavenard picture jyavenard  路  3Comments

vicatcu picture vicatcu  路  3Comments