Pages

Sunday 14 September 2014

Linux Error: strrev function is error ( undefined reference to `strrev' collect2: ld returned 1 exit status)




undefined reference to `strrev' collect2: ld returned 1 exit status

Functions like strupr, strlwr, strrev, which are available in ANSI C (Turbo C/C++) are not available in standard C (gcc).

That's because it quite probably *is not* included in the library.
I do not think the C standard library has ever included a function
called strrev(). Some implementation somewhere might provide one, but
it is not part of standard C.


I get linking error invoking this fucntion, as if it it not
 > inluded in the library.  Why?

 There are no function named strrev in the standard C
library. Furthermore, any implementation that defines a function with
a lovercase name starting with 'str' is non-conforming, as those names
are reserved.

...
 > /tmp/ccKGR6e9.o: In function `main':
 > /tmp/ccKGR6e9.o(.text+0x27): undefined reference to `strrev'
 > collect2: ld returned 1 exit status
 However, looking at my collection of non-standard header files, I
have a hunch that strrev() might be a MSVC-ism, so you might actually
have a chance to find some information about this extension in an
appropiate newsgroup like comp.os.ms-windows.programmer or similar.


0 comments:

Post a Comment