我正在尝试在 Arduino 上使用 Supermodified 伺服。
我的草图中还没有任何实际代码,我只是想编译库。我有很多错误。
在做了一些研究之后,我发现如果我将我的代码编译为 C 而不是 C++,我不会得到这些错误。但我不知道该怎么做!
我正在为 Linux x64 使用 Arduino 1.0。
@Omnifarious我的arduino草图中只有#include指令,此时是sketch_jan20.cpp
我添加了
#ifd __cplusplus{
extern "C"
#endif
这有助于消除以下错误,除了其中一个错误:布尔值的重新定义。当我评论那条线时,我得到了一大堆新的错误。它们都是相同的,包括以下一些变化:
C:\Users\Ventrius\Programming\Arduino1.01\libraries\ArduinoApiC\/zoCommands.h:131: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'zoCommandDoMove'
错误:
avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/ArduinoApiC /tmp/build3069866408398264713.tmp/sketch_jan20a.cpp -o/tmp/build3069866408398264713.tmp/sketch_jan20a.cpp.o
In file included from /usr/share/arduino/libraries/ArduinoApiC/zoSmsMaster.h:4:0,
from sketch_jan20a.cpp:1:
/usr/share/arduino/libraries/ArduinoApiC/zoTypes.h:39:18: error: redeclaration of C++ built-in type ‘bool’
In file included from /usr/share/arduino/libraries/ArduinoApiC/zoSmsMaster.h:5:0,
from sketch_jan20a.cpp:1:
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:19:29: error: non-local function ‘void zoErrorInit(volatile ZO_ERROR*)’ uses anonymous type
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:15:2: error: ‘typedef volatile struct<anonymous> ZO_ERROR’ does not refer to the unqualified type, so it is not used for linkage
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:20:27: error: non-local function ‘u08 zoErrorGet(volatile ZO_ERROR*)’ uses anonymous type
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:15:2: error: ‘typedef volatile struct<anonymous> ZO_ERROR’ does not refer to the unqualified type, so it is not used for linkage
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:21:44: error: non-local function ‘void zoErrorPut(volatile ZO_ERROR*, u08)’ uses anonymous type
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:15:2: error: ‘typedef volatile struct<anonymous> ZO_ERROR’ does not refer to the unqualified type, so it is not used for linkage
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:22:32: error: non-local function ‘bool zoErrorIsEmpty(volatile ZO_ERROR*)’ uses anonymous type
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:15:2: error: ‘typedef volatile struct<anonymous> ZO_ERROR’ does not refer to the unqualified type, so it is not used for linkage
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:24:30: error: non-local function ‘u08 zoErrorGetIsr(volatile ZO_ERROR*)’ uses anonymous type
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:15:2: error: ‘typedef volatile struct<anonymous> ZO_ERROR’ does not refer to the unqualified type, so it is not used for linkage
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:25:47: error: non-local function ‘void zoErrorPutIsr(volatile ZO_ERROR*, u08)’ uses anonymous type
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:15:2: error: ‘typedef volatile struct<anonymous> ZO_ERROR’ does not refer to the unqualified type, so it is not used for linkage
In file included from /usr/share/arduino/libraries/ArduinoApiC/zoSmsMaster.h:6:0,
from sketch_jan20a.cpp:1:
/usr/share/arduino/libraries/ArduinoApiC/zoProtocol.h:93:26: error: non-local function ‘bool zoProtocolCommandResponse(ZO_PROTOCOL_HAL*, ZO_PROTOCOL_PACKET*, volatile ZO_ERROR*)’ uses anonymous type
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:15:2: error: ‘typedef volatile struct<anonymous> ZO_ERROR’ does not refer to the unqualified type, so it is not used for linkage
In file included from sketch_jan20a.cpp:1:0:
/usr/share/arduino/libraries/ArduinoApiC/zoSmsMaster.h:55:18: warning: non-local variable ‘volatile ZO_ERROR* zoSmsMasterError’ uses anonymous type
/usr/share/arduino/libraries/ArduinoApiC/zoError.h:15:2: warning: ‘typedef volatile struct<anonymous> ZO_ERROR’ does not refer to the unqualified type, so it is not used for linkage