This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Undefined references when compiling C++ program
- From: Xavier Dufresne <xdufresne at gmx dot fr>
- To: cygwin at cygwin dot com
- Date: Fri, 05 Mar 2004 19:59:41 +0100
- Subject: Undefined references when compiling C++ program
Hello,
when I try to compile this...
//zozo.cc
#include <iostream>
int main()
{
std::cout << "Salut" << std::endl;
return 0;
}
...with...
gcc zozo.cc
...gcc give me...
/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x2f):zozo.cc:
undefined reference to `std::cout'
/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x34):zozo.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*)'
/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x3c):zozo.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> >&)'
/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x44):zozo.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> >&))'
/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x6d):zozo.cc:
undefined reference to `std::ios_base::Init::Init[in-charge]()'
/cygdrive/c/DOCUME~1/travonz/LOCALS~1/Temp/ccuTTqP6.o(.text+0x88):zozo.cc:
undefined reference to `std::ios_base::Init::~Init [in-charge]()'
collect2: ld returned 1 exit status
if I compile: int main(){return 0;} it's ok !
Do I have to specifie linking libraries with the -l option ?
thanks for your help.
Xavier
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/