undefined reference error while using 'gets'

Rohit Arul Raj rohitarulraj@gmail.com
Thu Nov 3 14:28:00 GMT 2011

Hi All,

I am using newlib v1.18 built with 'powerpc-elf' v4.5.2. While using
the 'gets' function call, i get the following error:

powerpc-elf/4.5.2/../../../../powerpc-elf/lib\libc.a(lib_a-gets.o): In
function `_gets_r':
gets.c:(.text+0x30): undefined reference to `__sfp_lock_acquire'
gets.c:(.text+0xa8): undefined reference to `__sfp_lock_release'

Based on the documentation, it has been mentioned that 'gets' is
obsolete and we need to use 'fgets'. But still i should not be getting
any undefined reference errors.

I took a look at the 'newlib\libc\stdio\gets.c' and i think we need to
include "local.h" to get these definitions. Is that right?

Let me know your suggestions.


More information about the Newlib mailing list