Undefined Reference to 'std::cout' etc.
Christopher Konvalin
chris@comuniq.com
Sat May 20 21:00:00 GMT 2000
Hi everyone,
I just upgraded to 2.90.8 and am having all kinds of problems getting my
code to link with the new libraries. I've done everything I can think of,
so I'm falling back to the big guns :) I'm using gcc/g++ 2.95.2, and am
trying to build a rather large C++ code base. I'm using *lots* of STL (the
principle reason I upgraded) and per company standards everything is
fully-qualified (e.g. std::cout).
I built 2.95.2 and 2.90.8 together, and are installed in /usr. I just
followed the build instructions on the site, with no special flags other
than --prefix. The first problem I noticed was the libstdc++ testsuite
failed on virtually every test (except for maybe two or three - I'll post
the results at the end of the email). Ok, not a good sign, but I started
the compile of my code anyway. The compile went through OK (minus a few
fixes) but as soon as I get to the linker I see *lots* of errors, all
pertaining to std::. Everything is built with -fhonor-std, so I'm a little
confused by this. The errors pretty much seem to cover anything in the
std:: namespace (e.g. cin/cout, std_iostream, basic_string, terminate,
etc.).
The LD_LIBRARY_PATH is set to /usr/lib, and here's a sample of the build
command:
g++ -c
/xxxxxxx/H245Signaling.cpp -g -O0 -Wall -fhonor-std -DANSI_PROTO -DFUNCTION_
BASED -DLINUX_BUILD -STATIC_SYMS .... bunch of include dirs ....
and the linker error:
/xxxx/xxxx/xxx/H245Signaling.cpp:290: undefined reference to 'std::cout'
/xxxx/xxxx/xxx/H245Signaling.cpp:290: undefined reference to
'std::basic_ostream<char, std::char_traits<char> > & std::operator
<<<std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char>
> &, char const *)'
The code it's failing on is pretty simple:
int SomeClass::SomeFunc()
{
std::cout << "xxxxyyyy" << std::endl;
...
}
One last thing - when I started the initial compiles, I would get errors
from std_limits.h about min() and max(). I don't have the exact errors in
front of me (I can reproduce them if needed) but they said something like
"...min() takes 0 args...", and I wasn't using min()/max() directly. I
worked around them, but I thought I'd mention it anyway.
If anyone could help me figure this one out, I'd be *very* grateful
(deadlines looming ominously...). I've tried just about every combination
of flags and builds I can think of, and scoured the mailing list for hints,
but to no avail. If more information is needed, just let me know.
Thanks!
Chris
---------------------------------------
Christopher Konvalin
Senior Software Developer
IP Telephony Group
Comuniq Inc., Rapid City, SD, USA
Phone: 605-348-7650
Fax: 605-348-4030
E-Mail: chris@comuniq.com
---------------------------------------
p ctime etime text data total name
+ 3 0.000 165028 30570 900172 17_intro/header_ciso646.cc
- 1 0.000 0 0 0 17_intro/header_fstream.cc
- 1 0.000 0 0 0 17_intro/header_iomanip.cc
...
...
+ 1 0.000 170580 30677 939735 17_intro/header_iosfwd.cc
-
-
-
-
-
-
+ 0 0.000 170612 30805 970487 18_support/numeric_limits.cc
...
More information about the Libstdc++
mailing list