arduino.h:48:17:致命错误:sam.h:没有这样的文件或目录

时间:2017-05-16 15:42:14

标签: visual-studio arduino arduino-ide

我正在尝试为Arduino M0 Pro编译一个简单的新项目('hello')。我在visual studio 2015中创建了一个新项目(使用vMicro)。

但我收到错误:

hello.ino: In file included from

arduino.h: 48:17: fatal error: sam.h: No such file or directory
   #include "sam.h"
   compilation terminated

通过Arduino IDE - 电路板管理器,我已经为Arduino SAM板和SAMD板安装了内核。目前它在Arduino IDE上:v1.6.18,SAM:v1.6.11和SAMD:v1.6.15(撰写本文时的最新版本)。

奇怪的是,我确实看到该项目已包含此文件,因为它显示在External Dependencies的文件树中,请参见屏幕截图。

file tree showing sam.h

我还检查了'hello.vcxproj'文件中的include路径。我已经删除了以下列表:

<AdditionalIncludeDirectories>
$(ProjectDir)..\..\..\..\..\Program Files (x86)\Arduino\libraries
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\hardware\samd\1.6.10\libraries
$(ProjectDir)..\libraries
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\hardware\samd\1.6.10\cores\arduino
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\hardware\samd\1.6.10\cores\arduino\avr
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\hardware\samd\1.6.10\cores\arduino\USB
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\hardware\samd\1.6.10\variants\arduino_mzero
$(ProjectDir)..\hello
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\4.5.0\CMSIS\Include\
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS-Atmel\1.0.0\CMSIS\Device\ATMEL\
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\arm-none-eabi
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\bits
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\sys
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\hardware\samd\1.6.10\system
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\hardware\samd\avr
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\hardware\samd\usb
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\lib\gcc\arm-none-eabi\4.8.3\include
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\4.5.0
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\4.5.0\Device\ATMEL\samd21\include
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\4.5.0\CMSIS\include
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\4.5.0\Device\ATMEL\samd21\include\component
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\4.5.0\Device\ATMEL\samd21\include\instance
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\4.5.0\Device\ATMEL\samd21\include\pio
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\4.5.0\Device\ATMEL\samd21\include\component
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS-Atmel\1.0.0\CMSIS\Device\ATMEL\samd21\include
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\CMSIS\include
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\CMSIS-Atmel\1.0.0\CMSIS\Device\ATMEL\samd21\include\component
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\CMSIS-Atmel\1.0.0\CMSIS\Device\ATMEL\samd21\include\instance
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\CMSIS-Atmel\1.0.0\CMSIS\Device\ATMEL\samd21\include\pio
$(ProjectDir)..\..\..\AppData\Local\arduino15\packages\arduino\tools\CMSIS\CMSIS-Atmel\1.0.0\CMSIS\Device\ATMEL\samd21\include\component
%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

即使我只是在Arduino IDE中打开一个全新的项目并尝试为Arduino M0编译它,我也会得到完全相同的错误!

我在这一点上陷入困​​境。我已尝试过,正如其他一些网站所建议的那样,卸载SAM,卸载SAMD,更改版本,但没有运气。

1 个答案:

答案 0 :(得分:0)

在我的情况下,具体的解决方案是删除C:\ Users [用户名] \ AppData \ Local \ Arduino15文件夹,并通过Arduino IDE Boards Manager重新安装我需要的板包。

请注意,这不会影响您在IDE中所做的任何库或其他更改。