我正在尝试将 vscode 与 arduino 一起使用,但没有成功。问题似乎与库路径有关。但我一直无法解决这个问题!我在 linux 上。
"message": "#include 检测到错误。请更新您的 includePath。此翻译单元 (/home/harold/Arduino/Saaf_Curing/Saaf_Curing.ino) 的智能感知功能将由标签解析器提供。",
我不知道如何找到我的 includePath。我无法执行 vscode 中给出的任何建议。
我想知道 vs 代码是否是正确的方向,因为它看起来很复杂?
IntelliSense使用c_cpp_properties.json >> includePath查找自动完成的标头,但我注意到我仍然需要在task.json >> task >> args内部指定包含路径来进行构建。
我在文档中发现includePath与我在“ -I”中指定的路径几乎相同:
您为此设置指定的路径与通过-I开关发送给编译器的路径相同。解析源文件后,IntelliSense引擎会在尝试解析它们的同时,将这些路径添加到您的#include指令指定的文件之前。这些路径不是递归搜索的。*
这是我的c_cpp_properties.json的示例:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"D:/github/dependencies/SDL2-2.0.8/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-posix-seh-rt_v6-rev0\\mingw64\\bin\\g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"${workspaceFolder}/**"
]
}
}
],
"version": 4
}
Run Code Online (Sandbox Code Playgroud)
和task.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "g++",
"args": [
"-g",
"main2.cpp", …
Run Code Online (Sandbox Code Playgroud)