Undefined function problem...
Mumit Khan
khan@xraylith.wisc.edu
Sat Dec 11 22:52:00 GMT 1999
In article < 385313DB.9ED190E3@colba.net >,
Lina Musallam <guardian@colba.net> wrote:
>I am trying to recompile a program which has been written in C a while
>back. Unfortunatly, the programmer is no longer with us (got a better
>job) and I am having a compilation problem : I am getting a message
>about undefined function call at the end of the compilation. I presume
>its the part when the compiler starts linking the libraries. The
>function in question is "sprintf" or some other basic function to C. I
>verified that the include statement is correct and that the header file
>exists in the path that the compiler is looking for; all checked out
>okay.
sprintf is an ANSI C function, and is quite likely sitting in your
C runtime library. If you provide a bit more info, perhaps we can
help.
1. What platform and what version of gcc?
$ gcc -v
2. What libraries are being linked in automatically?
$ cat foo.c
#include <string.h>
int
main ()
{
char buf[1024];
sprintf (buf, "%d", 10);
return 0;
}
$ gcc -o foo foo.c -v
3. Add -lc and see what happens?
$ gcc -o foo foo.c -lc
Regards,
Mumit
More information about the Gcc-help
mailing list