G++ 2.9.5 undefined reference to stdlibfunction problem.

Ross Nicoll rnicoll@lostics.demon.co.uk
Tue Aug 3 18:42:00 GMT 1999


This is probably just me being stupid, but I'm all out of ideas to fix
this.

I have some C++ code that uses the function fdopen(). Although I have
verified that the correct include is included, and even read the include
by hand, g++ still claims:

log.cpp: In method `void Log::Write(char *, ...)':
log.cpp:96: implicit declaration of function `int fdopen(...)'
log.cpp:96: assignment to `FILE *' from `int' lacks a cast


If I kludge this by putting the declaration into the file by hand, it
accepts it, until compile time, when it complains (log.cpp is part of
libe++commerce.a BTW):

g++  -L../lib -le++commerce test.o -o test.cgi
../lib/libe++commerce.a: In function `Log::Write(char *,...)':
/home/rnicoll/development/e++commerce/lib/log.cpp:96: undefined reference
to `fdopen(int, char const *)'
collect2: ld returned 1 exit status


If the source code would help, I'll send you it, but as I said, I'm sure
it's something I'm doing wrong; but please, before I pull the rest of my
hair out, what???

I also had an identical problem with ftruncate(), but worked around that
by taking ftruncate() out of the code. Unfortunately, I can't work around
the fdopen() call.


Thanks for your time.
-- 
  _   __  __  __
 /_) / / (_  (__	http://wired.dcs.st-and.ac.uk/~rnicoll/
/\  /_/  __)   /
______________/



More information about the Gcc-bugs mailing list