From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 Description of problem: Hardware: Dual processor Compaq W6000 running RH 7.2 Installed gcc version 2.95.3 20010315 (release), compiled from tarball sources obtained from Gnu web site. Installation directory /usr/local/bin Used this as default compiler Upgraded to RH 8.0,from iso's and then installed all available rpm updates, including glibc-2.3.2-4.80, and related rpms. I now have a Redhat 8.0 system, running the stock mp kernel which has two versions of gcc: 2.95.3 and 3.2, and with glibc 2.3.2. when I try to build a C++ program, using the two compilers, it compiles fine with gcc 2.95.3, but I get a bunch of unresolved symbols in the link step with gcc 3.2. If I add -lstdc++ to the link step, the symbols are resolved OK. Version-Release number of selected component (if applicable): glibc-2.3.2-4.80 How reproducible: Always Steps to Reproduce: 1.See Description 2. 3. Actual Results: linker error messages: new_main.o: In function `__tcf_0': /usr/include/c++/3.2/iostream:62: undefined reference to `std::ios_base::Init::~Init [in-charge]()' new_main.o:/usr/include/c++/3.2/iostream:62: undefined reference to `__gxx_personality_v0' encode_t.o: In function `__static_initialization_and_destruction_0': /home/johnk/projects/ofdm/warp.h:14: undefined reference to `__gxx_personality_v0' Expected Results: No error messages from the link step Additional info: #uname -a Linux xxxx.yyyyy.com 2.4.18-14smp #1 SMP Wed Sep 4 12:34:47 EDT 2002 i686 i686 i386 GNU/Linux #usr/bin/gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit Thread model: posix gcc version 3.2 20020903 (Red Hat Linux 8.0 3. #/usr/local/bin/gcc -v Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs gcc version 2.95.3 20010315 (release)
If you link with gcc driver, then you indeed have to supply -lstdc++ (or -lsupc++ if your program isn't using STL at all). g++ driver is what should be used to link C++ programs and shared libraries.