Solve the "#include detected an error. Please update includePath" issues and "Can not open source file" avr / pgmspace.h "" problem (VSCode conducted Arduino Development)

The following error may occur when writing code configured VSCode the Arduino environment

检测到 #include 错误。请更新 includePath。已为此翻译单元(E:\abc.ino)禁用波形曲线。C/C++(1696)

无法打开 源 文件 "avr/pgmspace.h" (dependency of "C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino\Arduino.h")C/C++(1696)

This problem is due VSCode not find the corresponding file causes, the solution is to enter the project folder .vscode folder (with VSCode open the project folder is automatically created), among the c_cpp_properties.json

Changed

Save the file to json

Solutions are needed to find the header files in the Arduino installation directory path which, added to the includePath them.
Such as the above error message is missing avr / pgmspace.h, found by searching for the file is located

C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr\pgmspace.h

Then the VSCode will

C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include

To find the corresponding files in this directory, the directory which can be added to includePath
required, separated by commas between (catalog directory, note the Windows directory path separator when adding backslash \, whereas in the configuration file a single trans slash is an escape character to separate double backslash \\ path)

Similarly, for example, I need to use Keyboard.h like libraries and newspaper VSCode unable to open the source file, you can search among Keyboard.h Arduino installation directory, navigate to

C:\Program Files (x86)\Arduino\libraries\Keyboard\src

In order to use all the header files among libraries directory can be changed to the following form includePath

Where \\ ** means looking at the path and all its subdirectories

2020.01.07

Guess you like

Origin www.cnblogs.com/wh201906/p/12162869.html