2013-06-19 68 views
1

由於多重定義錯誤,我無法編譯Atmel Studio 6.1,這似乎是由鏈接器重複「Libraries/lib_mcu/can/can_isp_protocol引起的。 o Libraries/lib_mcu/can/can_isp_protocol.o「有誰知道它爲什麼會這樣做?以下是編譯器輸出的列表。由Atmel Studio 6鏈接器引起的多重定義錯誤

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 

回答

2

鏈接器在其命令行上有兩次Libraries/lib_mcu/can/can_isp_protocol.o。由於重複的定義,鏈接失敗。

由於我沒有使用Atmel Studio 6,我無法描述刪除重複的確切步驟。

  1. 您可能已將項目添加can_isp_protocol.c兩次。檢查項目中的文件列表。檢查項目選項中的鏈接器設置。

  2. 它可能變成了兩倍,以及在(生成/手動創建)Makefile:搜索OBJECTSOBJS(一般來說搜索can_isp_protocol,不帶擴展名),它看起來是這樣的:

OBJECTS = can_isp_protocol.o can_isp_protocol.o XO喲

+0

對於我的生成(愛特梅爾7)這個錯誤是由冗餘夾雜startup_samd10.c'和'system_samd10的'引起的。在Device_Startup文件夾中。 –