gzc581 发表于 2013-1-21 23:38:05

求助:AVR Studio出问题:make: *** [receive.elf] Error 1

今天用mega8 写 nrf24l01程序,出现error,不知道什么原因,网上也找不到合适的,麻烦各位大神帮忙看看~

rm -rf main.o ad.o led.o 2401.oreceive.elf dep/* receive.hex receive.eep receive.lss receive.map
Build succeeded with 0 Warnings...
In file included from ../main.c:10:
../2401.h: In function 'nRF24L01_TxPacket':
../2401.h:199: warning: pointer targets in passing argument 2 of 'SPI_Write_Buf' differ in signedness
../2401.h:207:2: warning: "/*" within comment
../2401.h: In function 'init_NRF24L01':
../2401.h:214: warning: pointer targets in passing argument 2 of 'SPI_Write_Buf' differ in signedness
../2401.h:215: warning: pointer targets in passing argument 2 of 'SPI_Write_Buf' differ in signedness
../main.c: In function 'main':
../main.c:21: warning: implicit declaration of function 'nrf2401_init'
avr-gcc-mmcu=atmega8 -Wall -gdwarf-2 -std=gnu99         -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT ad.o -MF dep/ad.o.d-c../ad.c
In file included from ../ad.c:3:
../2401.h: In function 'nRF24L01_TxPacket':
../2401.h:199: warning: pointer targets in passing argument 2 of 'SPI_Write_Buf' differ in signedness
../2401.h:207:2: warning: "/*" within comment
../2401.h: In function 'init_NRF24L01':
../2401.h:214: warning: pointer targets in passing argument 2 of 'SPI_Write_Buf' differ in signedness
../2401.h:215: warning: pointer targets in passing argument 2 of 'SPI_Write_Buf' differ in signedness
In file included from ../2401.c:4:
../2401.h: In function 'nRF24L01_TxPacket':
../2401.h:199: warning: pointer targets in passing argument 2 of 'SPI_Write_Buf' differ in signedness
../2401.h:207:2: warning: "/*" within comment
../2401.h: In function 'init_NRF24L01':
../2401.h:214: warning: pointer targets in passing argument 2 of 'SPI_Write_Buf' differ in signedness
../2401.h:215: warning: pointer targets in passing argument 2 of 'SPI_Write_Buf' differ in signedness
avr-gcc -mmcu=atmega8 -Wl,-Map=receive.map main.o ad.o led.o 2401.o   -o receive.elf
ad.o: In function `Delay':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:101: multiple definition of `Delay'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:101: first defined here
ad.o: In function `SPI_RW':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:108: multiple definition of `SPI_RW'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:108: first defined here
ad.o: In function `SPI_RW_Reg':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:147: multiple definition of `SPI_RW_Reg'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:147: first defined here
ad.o: In function `SPI_Write_Buf':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:180: multiple definition of `SPI_Write_Buf'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:180: first defined here
ad.o: In function `nRF24L01_TxPacket':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:197: multiple definition of `nRF24L01_TxPacket'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:197: first defined here
ad.o:(.data+0x1): multiple definition of `TX_ADDRESS'
main.o:(.data+0x1): first defined here
ad.o: In function `init_NRF24L01':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:211: multiple definition of `init_NRF24L01'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:211: first defined here
ad.o:(.data+0x6): multiple definition of `RX_ADDRESS'
main.o:(.data+0x6): first defined here
ad.o: In function `UART_INIT':
D:\T-CTRL\T-ctrl-pro\default/../uartx.h:12: multiple definition of `UART_INIT'
main.o:D:\T-CTRL\T-ctrl-pro\default/../uartx.h:12: first defined here
ad.o: In function `UART_Putchar':
D:\T-CTRL\T-ctrl-pro\default/../uartx.h:23: multiple definition of `UART_Putchar'
main.o:D:\T-CTRL\T-ctrl-pro\default/../uartx.h:23: first defined here
ad.o: In function `UART_Putstring':
D:\T-CTRL\T-ctrl-pro\default/../uartx.h:29: multiple definition of `UART_Putstring'
main.o:D:\T-CTRL\T-ctrl-pro\default/../uartx.h:29: first defined here
ad.o:(.data+0x0): multiple definition of `TxBuf'
main.o:(.data+0x0): first defined here
2401.o: In function `Delay':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:101: multiple definition of `Delay'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:101: first defined here
2401.o: In function `SPI_RW':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:108: multiple definition of `SPI_RW'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:108: first defined here
2401.o: In function `SPI_RW_Reg':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:147: multiple definition of `SPI_RW_Reg'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:147: first defined here
2401.o: In function `SPI_Write_Buf':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:180: multiple definition of `SPI_Write_Buf'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:180: first defined here
2401.o: In function `nRF24L01_TxPacket':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:197: multiple definition of `nRF24L01_TxPacket'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:197: first defined here
2401.o:(.data+0x1): multiple definition of `TX_ADDRESS'
main.o:(.data+0x1): first defined here
2401.o: In function `init_NRF24L01':
D:\T-CTRL\T-ctrl-pro\default/../2401.h:211: multiple definition of `init_NRF24L01'
main.o:D:\T-CTRL\T-ctrl-pro\default/../2401.h:211: first defined here
2401.o:(.data+0x6): multiple definition of `RX_ADDRESS'
main.o:(.data+0x6): first defined here
2401.o:(.data+0x0): multiple definition of `TxBuf'
main.o:(.data+0x0): first defined here
make: *** Error 1
Build failed with 1 errors and 58 warnings...

faduo2012 发表于 2013-1-21 23:53:39

重定义了?

gzc581 发表于 2013-1-21 23:58:48

faduo2012 发表于 2013-1-21 23:53 static/image/common/back.gif
重定义了?

是的,我把所有的文件都和到一个主函数里就没事了。但是我的每个.h 都加了#ifndef......#endif,很奇怪呀......

faduo2012 发表于 2013-1-22 00:01:23

gzc581 发表于 2013-1-21 23:58 static/image/common/back.gif
是的,我把所有的文件都和到一个主函数里就没事了。但是我的每个.h 都加了#ifndef......#endif,很奇怪呀. ...

你好,能上传代码来看看不

笑笑我笑了 发表于 2013-1-22 02:12:39

貌似是Linking的时候标号有重复的。

gzc581 发表于 2013-1-24 10:18:53

faduo2012 发表于 2013-1-22 00:01 static/image/common/back.gif
你好,能上传代码来看看不

已解决,谢谢你~~是因为我在.h里面定义了个数组,后来放到.c里再在.h里声明就好了
页: [1]
查看完整版本: 求助:AVR Studio出问题:make: *** [receive.elf] Error 1