www.delorie.com/djgpp/v2faq/faq057.html | search |
| Previous | Next | Up | Top |
Q: Why does GCC complain that it cannot open -lstdcx?
Q: Why do I get "Undefined reference to yywrap" when linking programs produced by Flex?
When linking C++ programs, you can use either one of the gxx, gpp, or g++ commands (the latter on Windows 9X only) instead of gcc; they will then instruct the linker to also scan the C++ libraries automatically, so you don't have to remember doing that yourself.
Another reason for undefined references when linking C++ programs is that you mix GCC and libstdcxx.a from different releases: they are usually incompatible.
An error message about missing -lstdcx usually means that the linker cannot find the standard C++ library, libstdcxx.a. Look into your lib/ subdirectory to see if it's there; if not, unzip it from the gppNNNb.zip file. If libstdcxx.a exists but the linker still complains, you most probably have a problem related to long file names on Windows 9X (libstdcxx.a exceeds the DOS 8+3 limits). For a quick fix, try to set LFN=y in the environment and see if that helps. If that doesn't help, make sure you unpacked gppNNNb.zip with an unzip program which supports long file names. This issue is further complicated if you use RHIDE, and is described in full in the file gnu/gcc-2.81/problems.txt which comes with the GCC distribution (and which you should have read before installing it). Bottom line is that you need to add a line either to rhide.env or to DJGPP.ENV which says this:
RHIDE_TYPED_LIBS_DJGPP.cc=stdcxxWhen you add this line, make sure neither it nor the [rhide] line have trailing whitespace, otherwise RHIDE will not recognize these lines.
If your program uses a lot of floating-point math, or needs math functions beyond those specified in the ANSI/ISO standard, consider appending -lm to your link command line. The basic
math functions required by ANSI/ISO standard are included in the libc.a library, but libm.a includes higher quality versions of these functions, and also some functions not
included in the default library, like Gamma function and Bessel functions, support for Posix-compliant behavior in case of errors (e.g., it math functions from libm.a always set
errno
), a matherr
facility, etc.
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Sep 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)