I’m porting a library to RTP that uses strcpy, strdup, etc…
It defines _XOPEN_SOURCE, that’s why <string.h> won’t include the prototype
strdup.
So I defined __EXT_QNX manually before I include <string.h>, so compiling
goes fine.
Just the linker can’t find strdup. How come, as strdup should be in the
library anyway…
Thanks
Markus
Markus Loffler <loffler@ces.clemson.edu> wrote:
I’m porting a library to RTP that uses strcpy, strdup, etc…
It defines _XOPEN_SOURCE, that’s why <string.h> won’t include the prototype
strdup.
So I defined __EXT_QNX manually before I include <string.h>, so compiling
goes fine.
Just the linker can’t find strdup. How come, as strdup should be in the
library anyway…
Thanks
Markus
strdup is in libc, so it should be found. Is this a C++ project?
Could you please post the link line and error messages?
It is a C++ project.
I try to port Open Inventor, and replace the OpenGL code of the gears demo
with Open Inventor code.
cc gears.o tk.o -o gears -L/usr/lib -L/usr/X11R6/lib
-lX11 -lGLU -lGL -lang-c++ -lglide2x -lminihwc -lfxpci -lfxmisc -lm
-lph -lphrender -lsocket -lInventor
/usr/lib/libInventor.so: undefined reference to `strdup(char const *)’
cc: /usr/bin/ld error 1
make: *** [gears] Error 1
<cburgess@qnx.com> wrote in message news:90622m$g5v$1@nntp.qnx.com…
Markus Loffler <> loffler@ces.clemson.edu> > wrote:
I’m porting a library to RTP that uses strcpy, strdup, etc…
It defines _XOPEN_SOURCE, that’s why <string.h> won’t include the
prototype
strdup.
So I defined __EXT_QNX manually before I include <string.h>, so
compiling
goes fine.
Just the linker can’t find strdup. How come, as strdup should be in the
library anyway…
Thanks
Markusstrdup is in libc, so it should be found. Is this a C++ project?
Could you please post the link line and error messages?
There’s something very wrong here. The problem is that the prototypes
for the string functions aren’t being declared as extern “C”, which is
what the __BEGIN_DECLS macro does. So the linker is looking for the
mangled name of strdup.
Try setting _QNX_SOURCE instead of __EXT_QNX
Markus Loffler <loffler@ces.clemson.edu> wrote:
It is a C++ project.
I try to port Open Inventor, and replace the OpenGL code of the gears demo
with Open Inventor code.cc gears.o tk.o -o gears -L/usr/lib -L/usr/X11R6/lib
-lX11 -lGLU -lGL -lang-c++ -lglide2x -lminihwc -lfxpci -lfxmisc -lm
-lph -lphrender -lsocket -lInventor
/usr/lib/libInventor.so: undefined reference to `strdup(char const *)’
cc: /usr/bin/ld error 1
make: *** [gears] Error 1cburgess@qnx.com> > wrote in message news:90622m$g5v$> 1@nntp.qnx.com> …
Markus Loffler <> loffler@ces.clemson.edu> > wrote:
I’m porting a library to RTP that uses strcpy, strdup, etc…
It defines _XOPEN_SOURCE, that’s why <string.h> won’t include the
prototype
strdup.
So I defined __EXT_QNX manually before I include <string.h>, so
compiling
goes fine.
Just the linker can’t find strdup. How come, as strdup should be in the
library anyway…
Thanks
Markusstrdup is in libc, so it should be found. Is this a C++ project?
Could you please post the link line and error messages?