Visual Studio代码语法高亮显示错误,但编译(Visual Studio Code Syn

2019-09-28 01:21发布

Visual Studio代码重点介绍了我所有的过剩功能定义,但完美编译。 我怎样才能摆脱红色下划线的,而不使语法高亮?

包括main.h

#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <math.h>
#include <string>

我说我能想到的在include路径和浏览路径段的所有路径c_cpp_properties.json文件。

{
"name": "Linux",
"includePath": [
    "/usr/include",
    "/usr/include/GL",
    "/usr/local/include",
    "${workspaceRoot}",
    "/usr/include/x86_64-linux-gnu/c++/5",
    "/usr/include/c++/5",
    "/usr/lib/x86_64-linux-gnu"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
    "path": [
        "/usr/include",
        "/usr/include/GL",
        "/usr/local/include",
        "${workspaceRoot}",
        "/usr/include/x86_64-linux-gnu/c++/5",
        "/usr/include/c++/5",
        "/usr/lib/x86_64-linux-gnu"
    ],
    "limitSymbolsToIncludedHeaders": true,
    "databaseFilename": ""
    }
}

我使用Visual Studio代码1.18在Ubuntu 16.04和我的生成命令是:

g++ -g main.cpp -L/usr/lib/x86_64-linux-gnu -lGL -lglut -lGLEW -lGLU

有任何想法吗?

Answer 1:

设置"C_Cpp.intelliSenseMode": "Tag Parser"settings.json的伎俩。 非常感谢@Bob__



文章来源: Visual Studio Code Syntax Highlighting shows errors but compiles