在下在使用VSCode的时候遇到了以下问题#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/home/pi/works/mqtt_demo/mqtt_client.c).C/C++(1696),虽然说我实际开发编译是通过编写Makefile实现的,对我实际开发并不造成影响,但是IDE老是那么红着,显示 ERROR ,实属不雅:
那么问题来了,怎么给VSCode添加头文件的搜索路径呢?
1)在vscode中按Ctrl+Shift+P 输入configuration,选择C/C++:Edit Configuration(JSON);
2)编辑打开的c_cpp_properties.json文件,在configurations里的includePath中添加你需要引入的头文件的路径,保存即可。
修改前:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-arm"
}
],
"version": 4
}
修改后:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include/cjson/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-arm"
}
],
"version": 4
}
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/116946.html