This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
errors when linking c++ on cygwin
- From: Chris Meyer <cmeyer at gatan dot com>
- To: gcc <gcc at gcc dot gnu dot org>
- Date: Mon, 11 Mar 2002 14:36:47 -0800
- Subject: errors when linking c++ on cygwin
Hi,
I built the 3.1 branch under cygwin on windows and when I try to compile
a simple hello world program using cout I get the following errors:
bash-2.05a$ g++3 -save-temps test.cc
test.o(.text+0x2f):test.cc: undefined reference to `std::cout'
test.o(.text+0x3c):test.cc: 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*)'
test.o(.text+0x47):test.cc: undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char>
>&)'
test.o(.text+0x4c):test.cc: undefined reference to
`std::basic_ostream<char, std::char_traits<char>
>::operator<<(std::basic_ostream<char, std::char_traits<char> >&
(*)(std::basic_ostream<char, std::char_traits<char> >&))'
test.o(.text+0x75):test.cc: undefined reference to
`std::ios_base::Init::Init[in-charge]()'
test.o(.text+0x90):test.cc: undefined reference to
`std::ios_base::Init::~Init [in-charge]()'
test.o(.eh_frame+0x11):test.cc: undefined reference to
`___gxx_personality_v0'
collect2: ld returned 1 exit status
bash-2.05a$ g++3 -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-cygwin/3.1/specs
Configured with: ../gcc/configure --enable-languages=c,objc,c++
--program-suffix=3
Thread model: single
gcc version 3.1 20020311 (prerelease)
bash-2.05a$
The program is
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!\n" << endl;
return 0;
}
When I run the equivalent program and use 'c' instead of c++ it works
and links fine.
Has anyone run into any similar problems or can anyone point me in a
useful direction?