[转帖]在xTIMEcomposer创建错误
我创建了一个xTimeexposer项目。当我创建它时,许多错误出现
像下面:
In file included from ../src/NRF24L01.xc:8:
NRF24L01.h:17: error: `XS1_PORT_1H' undeclared here (not in a function)
In file included from ../src/NRF24L01.xc:8:
NRF24L01.h:17: error: invalid initializer
NRF24L01.h:18: error: `XS1_PORT_1E' undeclared here (not in a function)
NRF24L01.h:18: error: invalid initializer
NRF24L01.h:19: error: `XS1_PORT_1I' undeclared here (not in a function)
NRF24L01.h:19: error: invalid initializer
NRF24L01.h:20: error: `XS1_PORT_1D' undeclared here (not in a function)
NRF24L01.h:20: error: invalid initializer
NRF24L01.h:21: error: `XS1_PORT_1A' undeclared here (not in a function)
NRF24L01.h:21: error: invalid initializer
NRF24L01.h:22: error: `XS1_PORT_1C' undeclared here (not in a function)
NRF24L01.h:22: error: invalid initializer
../src/NRF24L01.xc:19: error: initializer element is not constant
../src/NRF24L01.xc:20: error: initializer element is not constant
../src/NRF24L01.xc:21: error: initializer element is not constant
../src/NRF24L01.xc: In function `init_io':
../src/NRF24L01.xc:43: error: output to an input-designated port
../src/NRF24L01.xc:44: error: unknown function identifier `delay_microseconds' (possibly missing prototype?)
../src/NRF24L01.xc: In function `SPI_RW':
../src/NRF24L01.xc:62: warning: unused variable `a'
../src/NRF24L01.xc: In function `NRF24L01_TxPacket':
../src/NRF24L01.xc:220: error: invalid operands to binary !=
../src/NRF24L01.xc: At top level:
../src/NRF24L01.xc:242: error: parse error before "bit"
../src/NRF24L01.xc: In function `Check_ACK':
../src/NRF24L01.xc:244: error: conditional expression is not arithmetic
../src/NRF24L01.xc:247: error: `clear' undeclared (first use in this function)
../src/NRF24L01.xc:247: error: (Each undeclared identifier is reported only once
../src/NRF24L01.xc:247: error: for each function it appears in.)
../src/NRF24L01.xc:250: error: output to an input-designated port
xmake[1]: *** [.build_Debug/src/NRF24L01.xc.o] Error 1
xmake: *** [bin/Debug/app_nrf24l01_soft_spi_Debug.xe] Error 2
回答:
把下面的代码添加到你源文件顶部:
#include <xs1.h>
发表时间:2014年8月4日14:30:16