Mail Archives: cygwin/2004/03/05/14:20:28
At 01:59 PM 3/5/2004, you wrote:
>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 ?
Ugh!
Did you think of checking the email archives? Do you realize this question
is really not Cygwin-specific so it's off-topic? Anyway, use 'g++' to
compile C++ source.
--
Larry Hall http://www.rfk.com
RFK Partners, Inc. (508) 893-9779 - RFK Office
838 Washington Street (508) 893-9889 - FAX
Holliston, MA 01746
--
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/
- Raw text -