错误不会显示在VS Code上

时间:2019-02-17 09:59:26

标签: visual-studio-code

我正在为C ++设置我的VS代码。我在Windows 10上使用1.31.1 x64版本,安装C / C ++扩展版本0.21.0。以下是我的设置:

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "MinGW",
            "includePath": [
                "${workspaceFolder}/**",
                "C:/MinGW/lib/gcc/mingw32/8.2.0/include/**"
            ],
            "defines": [
                "LOCAL"
            ],
            "cStandard": "c11",
            "cppStandard": "c++14",
            "intelliSenseMode": "clang-x64",
            "compilerPath": "C:/MinGW/bin/g++.exe"
        }
    ],
    "version": 4
}

task.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "C++ compile and run",
            "type": "shell",
            "command": "g++ \"${file}\" -O2 -static -std=c++14 -DLOCAL -o \"${fileDirname}/${fileBasenameNoExtension}.exe\" && \"${fileDirname}/${fileBasenameNoExtension}.exe\"",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "clear": true,
                "echo": false,
                "panel": "shared"
            }
        }
    ]
}

我简单的测试程序:

#include <iostream>

using namespace std;

int main() {
    cout << "hello world"
}

我通过上述任务运行了代码。该代码缺少分号,但错误仅显示在终端选项卡中,而问题选项卡以及文本编辑器中均未显示。我错过了什么吗?

1 个答案:

答案 0 :(得分:0)

我找到了打开错误曲线的设置:

Preferences-> Setting->搜索Intellisense->在Enable中选择C_Cpp: Error Squiggles

您应该同时检查用户设置和工作区设置。