我遇到了Atmel Studio 6.1的问题,由于多个定义错误导致我无法编译,这似乎是由链接器重复“Libraries / lib_mcu / can / can_isp_protocol.o Libraries / lib_mcu / can / can_isp_protocol引起的。 o“有谁知道为什么会这样做?下面是编译器输出的列表。
Task "RunCompilerTask"
C:\Program Files (x86)\Atmel\Atmel Studio 6.1\shellUtils\make.exe all
Building file: ../Libraries/lib_mcu/can/can_drv.c
Invoking: AVR/GNU C Compiler : 3.4.2
"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin\avr-gcc.exe" -funsigned-char -funsigned-bitfields -DDEBUG -I".." -I"../Libraries" -I"../Libraries/lib_board" -I"../Libraries/lib_mcu" -I"../Libraries/lib_mcu/can" -I"../Libraries/lib_mcu/eeprom" -I"../Libraries/lib_mcu/flash" -I"../Libraries/lib_module/isp" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=at90can128 -c -std=gnu99 -MD -MP -MF "Libraries/lib_mcu/can/can_drv.d" -MT"Libraries/lib_mcu/can/can_drv.d" -MT"Libraries/lib_mcu/can/can_drv.o" -o "Libraries/lib_mcu/can/can_drv.o" "../Libraries/lib_mcu/can/can_drv.c"
Finished building: ../Libraries/lib_mcu/can/can_drv.c
Building file: ../Libraries/lib_mcu/can/can_isp_protocol.c
Invoking: AVR/GNU C Compiler : 3.4.2
"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin\avr-gcc.exe" -funsigned-char -funsigned-bitfields -DDEBUG -I".." -I"../Libraries" -I"../Libraries/lib_board" -I"../Libraries/lib_mcu" -I"../Libraries/lib_mcu/can" -I"../Libraries/lib_mcu/eeprom" -I"../Libraries/lib_mcu/flash" -I"../Libraries/lib_module/isp" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=at90can128 -c -std=gnu99 -MD -MP -MF "Libraries/lib_mcu/can/can_isp_protocol.d" -MT"Libraries/lib_mcu/can/can_isp_protocol.d" -MT"Libraries/lib_mcu/can/can_isp_protocol.o" -o "Libraries/lib_mcu/can/can_isp_protocol.o" "../Libraries/lib_mcu/can/can_isp_protocol.c"
Finished building: ../Libraries/lib_mcu/can/can_isp_protocol.c
Building file: ../Libraries/lib_mcu/can/reduced_can_lib.c
Invoking: AVR/GNU C Compiler : 3.4.2
"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin\avr-gcc.exe" -funsigned-char -funsigned-bitfields -DDEBUG -I".." -I"../Libraries" -I"../Libraries/lib_board" -I"../Libraries/lib_mcu" -I"../Libraries/lib_mcu/can" -I"../Libraries/lib_mcu/eeprom" -I"../Libraries/lib_mcu/flash" -I"../Libraries/lib_module/isp" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=at90can128 -c -std=gnu99 -MD -MP -MF "Libraries/lib_mcu/can/reduced_can_lib.d" -MT"Libraries/lib_mcu/can/reduced_can_lib.d" -MT"Libraries/lib_mcu/can/reduced_can_lib.o" -o "Libraries/lib_mcu/can/reduced_can_lib.o" "../Libraries/lib_mcu/can/reduced_can_lib.c"
Finished building: ../Libraries/lib_mcu/can/reduced_can_lib.c
Building file: ../Libraries/lib_mcu/eeprom/eeprom_lib.c
Invoking: AVR/GNU C Compiler : 3.4.2
"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin\avr-gcc.exe" -funsigned-char -funsigned-bitfields -DDEBUG -I".." -I"../Libraries" -I"../Libraries/lib_board" -I"../Libraries/lib_mcu" -I"../Libraries/lib_mcu/can" -I"../Libraries/lib_mcu/eeprom" -I"../Libraries/lib_mcu/flash" -I"../Libraries/lib_module/isp" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=at90can128 -c -std=gnu99 -MD -MP -MF "Libraries/lib_mcu/eeprom/eeprom_lib.d" -MT"Libraries/lib_mcu/eeprom/eeprom_lib.d" -MT"Libraries/lib_mcu/eeprom/eeprom_lib.o" -o "Libraries/lib_mcu/eeprom/eeprom_lib.o" "../Libraries/lib_mcu/eeprom/eeprom_lib.c"
Finished building: ../Libraries/lib_mcu/eeprom/eeprom_lib.c
Building file: ../Libraries/lib_mcu/flash/flash_boot_drv.c
Invoking: AVR/GNU C Compiler : 3.4.2
"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin\avr-gcc.exe" -funsigned-char -funsigned-bitfields -DDEBUG -I".." -I"../Libraries" -I"../Libraries/lib_board" -I"../Libraries/lib_mcu" -I"../Libraries/lib_mcu/can" -I"../Libraries/lib_mcu/eeprom" -I"../Libraries/lib_mcu/flash" -I"../Libraries/lib_module/isp" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=at90can128 -c -std=gnu99 -MD -MP -MF "Libraries/lib_mcu/flash/flash_boot_drv.d" -MT"Libraries/lib_mcu/flash/flash_boot_drv.d" -MT"Libraries/lib_mcu/flash/flash_boot_drv.o" -o "Libraries/lib_mcu/flash/flash_boot_drv.o" "../Libraries/lib_mcu/flash/flash_boot_drv.c"
Finished building: ../Libraries/lib_mcu/flash/flash_boot_drv.c
Building file: ../Libraries/lib_mcu/flash/flash_boot_lib.c
Invoking: AVR/GNU C Compiler : 3.4.2
"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin\avr-gcc.exe" -funsigned-char -funsigned-bitfields -DDEBUG -I".." -I"../Libraries" -I"../Libraries/lib_board" -I"../Libraries/lib_mcu" -I"../Libraries/lib_mcu/can" -I"../Libraries/lib_mcu/eeprom" -I"../Libraries/lib_mcu/flash" -I"../Libraries/lib_module/isp" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=at90can128 -c -std=gnu99 -MD -MP -MF "Libraries/lib_mcu/flash/flash_boot_lib.d" -MT"Libraries/lib_mcu/flash/flash_boot_lib.d" -MT"Libraries/lib_mcu/flash/flash_boot_lib.o" -o "Libraries/lib_mcu/flash/flash_boot_lib.o" "../Libraries/lib_mcu/flash/flash_boot_lib.c"
Finished building: ../Libraries/lib_mcu/flash/flash_boot_lib.c
Building file: ../Libraries/lib_module/isp/isp_lib.c
Invoking: AVR/GNU C Compiler : 3.4.2
"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin\avr-gcc.exe" -funsigned-char -funsigned-bitfields -DDEBUG -I".." -I"../Libraries" -I"../Libraries/lib_board" -I"../Libraries/lib_mcu" -I"../Libraries/lib_mcu/can" -I"../Libraries/lib_mcu/eeprom" -I"../Libraries/lib_mcu/flash" -I"../Libraries/lib_module/isp" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=at90can128 -c -std=gnu99 -MD -MP -MF "Libraries/lib_module/isp/isp_lib.d" -MT"Libraries/lib_module/isp/isp_lib.d" -MT"Libraries/lib_module/isp/isp_lib.o" -o "Libraries/lib_module/isp/isp_lib.o" "../Libraries/lib_module/isp/isp_lib.c"
Finished building: ../Libraries/lib_module/isp/isp_lib.c
Building file: .././main_can_bootloader_example.c
Invoking: AVR/GNU C Compiler : 3.4.2
"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin\avr-gcc.exe" -funsigned-char -funsigned-bitfields -DDEBUG -I".." -I"../Libraries" -I"../Libraries/lib_board" -I"../Libraries/lib_mcu" -I"../Libraries/lib_mcu/can" -I"../Libraries/lib_mcu/eeprom" -I"../Libraries/lib_mcu/flash" -I"../Libraries/lib_module/isp" -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=at90can128 -c -std=gnu99 -MD -MP -MF "main_can_bootloader_example.d" -MT"main_can_bootloader_example.d" -MT"main_can_bootloader_example.o" -o "main_can_bootloader_example.o" ".././main_can_bootloader_example.c"
Finished building: .././main_can_bootloader_example.c
Building target: CAN-Bootloader.elf
Invoking: AVR/GNU Linker : 3.4.2
"C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.2.939\avr8-gnu-toolchain\bin\avr-gcc.exe" -o CAN-Bootloader.elf Libraries/lib_mcu/can/can_drv.o Libraries/lib_mcu/can/can_isp_protocol.o Libraries/lib_mcu/can/can_isp_protocol.o Libraries/lib_mcu/can/reduced_can_lib.o Libraries/lib_mcu/eeprom/eeprom_lib.o Libraries/lib_mcu/flash/flash_boot_drv.o Libraries/lib_mcu/flash/flash_boot_lib.o Libraries/lib_module/isp/isp_lib.o Libraries/lib_module/isp/isp_lib.o main_can_bootloader_example.o -Wl,-Map="CAN-Bootloader.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -Wl,-section-start=.text=0x1e000 -mmcu=at90can128
答案 0 :(得分:2)
链接器在其命令行上有Libraries/lib_mcu/can/can_isp_protocol.o
两次。由于重复定义,链接失败。
由于我没有使用Atmel Studio 6,因此无法描述删除副本的确切步骤。
您可能已向项目添加了can_isp_protocol.c
两次。检查项目中的文件列表。检查项目选项中的链接器设置。
在(生成/手动创建)Makefile
中可能会出现两次:搜索OBJECTS
或OBJS
(通常会搜索can_isp_protocol
,没有扩展名),它可能看起来像这样:
OBJECTS = can_isp_protocol.o can_isp_protocol.o x.o y.o