2

我在使用 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 
4

1 回答 1

2

链接器Libraries/lib_mcu/can/can_isp_protocol.o在其命令行上有两次。由于重复定义,链接失败。

由于我没有使用 Atmel Studio 6,因此我无法描述删除重复项的确切步骤。

  1. 您可能已经向该can_isp_protocol.c项目添加了两次。检查项目中的文件列表。检查项目选项中的链接器设置。

  2. 它可能在(生成/手动创建)中出现两倍Makefile:搜索OBJECTSOBJS(一般来说搜索can_isp_protocol,没有扩展名),它可能看起来像这样:

对象 = can_isp_protocol.o can_isp_protocol.o xo yo

于 2013-06-19T18:41:13.157 回答