undefined reference to `__eewr_byte_m169p
今天在用codeblock打开几年前的avr工程,编译的时候,出错了,错误是 undefined reference to `eewr_byte_m169p。 经过1个小时的努力,终于找到问题所在了。 解释: As you see the EEPROM support has changed in recent years so that now the header files identify the AVR you are using (mega644) and then concatenate this onto the eewrbyte* style routine names and these are then provided in the link from the device specific .o file. When this works the map file shows something like: e:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr5\libc.a(eewr_byte_atmega644.o) test.o (__eewr_byte_m644) That's built on Windows with WinAVR but the point is that it's ../avr/lib/avr5/libc.a that is providing the function. If you get undefined ref then that suggests that you environment is not linking with the right libc.a Maybe show your complete build output? Is the -mmcu=atmega644 being passed to the link as well as the compiles?
解决办法很简单,libc.a需要选择../avr/lib/avr5/libc.a这个才行。