User forums > Using Code::Blocks
Linker Error
(1/1)
joneewheelock:
I have problem with linking when I use code::Blocks for AVR. I used Atrduino library and few arduino header files during compilation. Issue comes only in CB. There is no issue if I build with Atmel Studio. Could not find the exact problem.
Also attached log from Codeblocks and both Atmel Studio (not complete log. Just linking related).
BlueHazzard:
i am not quiet sure, but i think your linking commands are wrong...
--- Code: ---avr-g++.exe -LC:\WinAVR\avr\lib -o Debug\CPP_Project_With_Core.a_Library.elf Debug\ir_Aiwa.o Debug\ir_Denon.o Debug\ir_Dish.o Debug\ir_JVC.o Debug\ir_Lego_PF.o Debug\ir_LG.o Debug\ir_Mitsubishi.o Debug\ir_NEC.o Debug\ir_Panasonic.o Debug\ir_RC5_RC6.o Debug\ir_Samsung.o Debug\ir_Sanyo.o Debug\ir_Sharp.o Debug\ir_Sony.o Debug\ir_Template.o Debug\ir_Whynter.o Debug\irPronto.o Debug\irRecv.o Debug\IRremote.o Debug\irSend.o Debug\main.o -mmcu=atmega328p -Wl, -lm -Map=Debug\CPP_Project_With_Core.a_Library.map,--cref Library\libcore.a
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: : No such file: Invalid argument
avr-g++.exe: unrecognized option '-Map=Debug\CPP_Project_With_Core.a_Library.map,--cref'
--- End code ---
in your linker commands*) there should be this line:
--- Code: ----Wl,-Map=$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).map,--cref
--- End code ---
No white spaces there...
greetings
*) Project->Build Options->Select the top most in the tree view on the left->Linker settings->Other linker options
BlueHazzard:
Yes, your linker commands are messed up...
--- Code: ----Wl, -lm -Map=Debug\CPP_Project_With_Core.a_Library.map,--cref
--- End code ---
--- Code: ----Wl
--- End code ---
says the compiler to pass the following commands to the linker. The commands are separated with ','
--- Code: ----lm
--- End code ---
tells the linker to use the library libm.a (don't think that this is necessary...
--- Code: ----Map=Debug\CPP_Project_With_Core.a_Library.map
--- End code ---
tells the linker to create a map file. This option has to be passed to the linker with '-Wl' but there is a missing ',' and the command gets interpreted ass a g++ command... And g++ does not know what this is...
joneewheelock:
Great, Thank You. Works now. I was not familiar with Make file or Linker arguments. Used defaults that I used with AVR-C programs. But started giving problem with CPP programs. My options are now:
-Wl,-Map=$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).map,--cref
Navigation
[0] Message Index
Go to full version