检测到#include错误,无法使用Visual Studio代码[intelliSense]编译Arduino项目

时间:2018-02-17 14:03:23

标签: visual-studio arduino intellisense include-path

我正在使用Visual Studio Code,Arduino,C和intelliSense插件。我只是将DHTNEW库文件夹放入我的项目中,并创建一个空的.ino草图,当我尝试包含和" dhtnew.h" intelliSense开始给我包含错误。 我的c_cpp_properties.json看起来像这样:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include",
                "C:/MinGW/include",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed",
                "C:\\Program Files (x86)\\Arduino\\libraries\\LiquidCrystal\\src"
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "path": [
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed",
                    "C:/MinGW/include/*",
                    "C:\\Program Files (x86)\\Arduino\\libraries\\LiquidCrystal\\src"
                ]
            },
            "intelliSenseMode": "clang-x64",
            "defines": [
                "_DEBUG",
                "UNICODE",
                "__GNUC__=6",
                "__cdecl=__attribute__((__cdecl__))"
            ]
        }
    ],
    "version": 3
}

错误:

LiquidCrystal.h: "C:\\Program Files (x86)\\Arduino\\libraries\\LiquidCrystal\\src"
cannot open source file "Print.h"

mysketch.ino
#include errors detected. Please update your includePath. IntelliSense features for this translation unit (.ino path) will be provided by the Tag Parser.
cannot open source file "Print.h" (dependency of "LiquidCrystal.h")
cannot open source file "dhtnew.h"

当我点击<LiquidCrystal.h>和/或"dhtnew.h"上的黄色灯泡时,它会显示Edit "includePath" setting

我尝试将"${workspaceRoot}"添加到c_cpp_properties.json,但它没有帮助。显然它不会编译:

输出:

[Starting] Verify sketch - my_sketch.ino
[Warning] Output path is not specified. Unable to reuse previously compiled files. Verify could be slow. See README.
Looking for library 'user32'
Adding paths from jna.library.path: null
Trying user32.dll
Found library 'user32' at user32.dll
Looking for library 'shell32'
Adding paths from jna.library.path: null
Trying shell32.dll
Found library 'shell32' at shell32.dll
Looking for library 'Ole32'
Adding paths from jna.library.path: null
Trying Ole32.dll
Found library 'Ole32' at Ole32.dll
Sto caricando la configurazione...
Sto inizializzando i pacchetti...
Sto preparando le schede...
Sto verificando...
d:\Antonio\..\my_sketch.ino:11:20: fatal error: dhtnew.h: No such file or directory

 #include "dhtnew.h"

                    ^

compilation terminated.

exit status 1
[Error] Exit with code=1

0 个答案:

没有答案