Visual Studio代码语法高亮显示错误但可以编译 [英] Visual Studio Code Syntax Highlighting shows errors but compiles
问题描述
Visual Studio Code突出显示了我所有的过剩函数,但没有错误地进行编译.如何在不禁用语法突出显示的情况下摆脱红色下划线?
Visual Studio Code highlights all my glut functions as undefined, but compiles flawlessly. How can I get rid of the red underlining, without deactivating the syntax highlighting?
包含main.h
:
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include <math.h>
#include <string>
我在c_cpp_properties.json
文件的包含路径"和浏览路径"部分中添加了所有可以想到的路径.
I added all paths I could think of to the include path and browse path section in the c_cpp_properties.json
file.
{
"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": ""
}
}
我在Ubuntu 16.04上使用Visual Studio Code 1.18,构建命令为:
I use Visual Studio Code 1.18 on Ubuntu 16.04 and my build command is:
g++ -g main.cpp -L/usr/lib/x86_64-linux-gnu -lGL -lglut -lGLEW -lGLU
有什么想法吗?
推荐答案
在settings.json
中设置"C_Cpp.intelliSenseMode": "Tag Parser"
可以解决问题.非常感谢@Bob __
Setting the "C_Cpp.intelliSenseMode": "Tag Parser"
in the settings.json
does the trick. Thanks a lot @Bob__
这篇关于Visual Studio代码语法高亮显示错误但可以编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!