gnu.gcc.help
[Top] [All Lists]

Newbie gcc question

Subject: Newbie gcc question
From: "Nate Sternberg"
Date: 29 Jul 2006 21:52:04 -0700
Newsgroups: gnu.gcc.help
I used to program in C++ in about eight years ago, in djgpp in Windows.
 I'm now getting back into it, and have to use gcc and cygwin (my first
time using either).  I'm running into what is probably a really dumb
problem, but can't figure it out.

My program is trivial:

#include <iostream>
int main() { return 0; }

But when I compile it, I get:

$ gcc test2.cpp -o test2.exe
/cygdrive/c/DOCUME~1/Nate/LOCALS~1/Temp/cc67acqk.o:test2.cpp:(.text+0xd):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::size() const'
/cygdrive/c/DOCUME~1/Nate/LOCALS~1/Temp/cc67acqk.o:test2.cpp:(.text+0x60):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::operator[](unsigned int) const'
/cygdrive/c/DOCUME~1/Nate/LOCALS~1/Temp/cc67acqk.o:test2.cpp:(.text+0x9f):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::operator[](unsigned int) const'
/cygdrive/c/DOCUME~1/Nate/LOCALS~1/Temp/cc67acqk.o:test2.cpp:(.text+0xce):
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::operator[](unsigned int) const'
/cygdrive/c/DOCUME~1/Nate/LOCALS~1/Temp/cc67acqk.o:test2.cpp:(.text+0x14f):
undefined reference to `std::ios_base::Init::Init()'
/cygdrive/c/DOCUME~1/Nate/LOCALS~1/Temp/cc67acqk.o:test2.cpp:(.text+0x16a):
undefined reference to `std::ios_base::Init::~Init()'
collect2: ld returned 1 exit status

This must be something obvious.  Can someone nudge me in the right
direction?


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy