我在Linux上使用最新版本的Visual Studio Code和C / C ++扩展。我试图找出为什么找到我的包含文件时遇到问题。
在一个.c文件中,它显示以下内容:
#include "tournament.h"
#include "layout.h"
#include "random.h"
#include "paytable.h"
#include "widgets.h"
#include "sound.h"
#include "leaderboard.h"
tournament.h
和sound.h
突出显示代码无法找到这些文件,即使它们与其他包含的文件位于同一目录中。
我已经进入c_cpp_properties.json并编辑了Linux部分并添加了包含路径目录,如下所示:
{
"name": "Linux",
"includePath": [
"/home/jnorton/build.kgisystems/src/svn/tournament/trunk",
"/usr/include/atk-1.0",
"/usr/lib64/gtk-2.0/include",
"/usr/include/glib-2.0",
"/usr/include/gtk-2.0",
"/usr/local/include",
"/usr/include",
"/usr/include/bits",
"/usr/include/c++/7",
"${workspaceRoot}",
"/usr/include/c++/7/tr1",
"/usr/include/c++/7/x86_64-redhat-linux",
"/usr/include/gdk-pixbuf-2.0",
"/usr/include/pango-1.0",
"/usr/include/cairo"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/home/jnorton/build.kgisystems/src/svn/tournament/trunk",
"/usr/include/atk-1.0",
"/usr/lib64/gtk-2.0/include",
"/usr/include/glib-2.0",
"/usr/include/gtk-2.0",
"/usr/local/include",
"/usr/include",
"/usr/include/bits",
"/usr/include/c++/7",
"${workspaceRoot}",
"/usr/include/c++/7/tr1",
"/usr/include/c++/7/x86_64-redhat-linux",
"/usr/include/gdk-pixbuf-2.0",
"/usr/include/pango-1.0",
"/usr/include/cairo",
"/home/jnorton/build.kgisystems/src/svn/tournament/trunk"
],
"limitSymbolsToIncludedHeaders": false,
"databaseFilename": ""
}
},
我已经关注guidelines并且智能感知仍然无法正常工作。
我错过了什么?
答案 0 :(得分:1)
尝试将此行添加到settings.json,它似乎对我有用:
"C_Cpp.intelliSenseEngine": "Tag Parser",
似乎允许IntelliSense提供模糊结果。
答案 1 :(得分:1)
我正在运行Visual Studio Code并遇到与gtk / gtk.h相同的问题
to with:
[正在运行] cd “/ home / rion / VisualStudio_Workspaces / Configurator_Workspace /”&&克++ ConfiguratorWindows.cc -o ConfiguratorWindows&& “/家/理音/ VisualStudio_Workspaces / Configurator_Workspace /” ConfiguratorWindows ConfiguratorWindows.cc:1:15:致命错误:gtk:没有这样的文件或 目录编译终止。
[完成]退出,代码= 1,在0.045秒
我已经完成了所有的事情 - 调整了包含路径的东西,甚至在#include <>
标签中明确地写了整个路径,向The Old Ones祈祷......
有一种奇怪的燃烧橡胶气味,还有一些奇怪的呻吟声从楼上的衣柜里流出来,但路径还是没有解决。