|ARM Technical Support Knowledge Articles|
Applies to: GNU C Compiler for ARM
Information in this article applies to:
I have problems when linking C code that contains calls to standard library functions like printf. My target is Keil MCB2100 with Philips LPC2129 CPU and I am using the GNU C Compiler that was included with this Board.
When I link my application I get the message listed below:
linking... main.o(.text+0x18): In function 'main': main.c(8): error: undefined reference to 'printf' collect2: ld returned 1 exit status
You need to configure the GNU Run-time system. A good example that shows this is in the folder KeilARMGNUExamplesMeasure. Take a look at the dialog Project — Options — Linker. It is important that you add standard run-time libraries and that you re-target the low-level output routines with similar functions as shown in the files SYSCALLS.C and SERIAL.C.
As an alternative, you may download the current revision of the Keil ARM tools and use the Keil CARM Compiler. The run-time system of this compiler is designed for embedded systems and will work instantly with the MCB2100 Board.
Article last edited on: 2007-01-16 14:29:43
Did you find this article helpful? Yes No
How can we improve this article?