This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc: std::cout problem


On Tue, 30 Mar 2004, David wrote:

> The source code was:
> -------------------------------------------------------
> #include <iostream>
>
> int main()
> {
>
> std::cout << "Hello,World!";
>
> }
>
> --------------------------------------------
>
> and from the shell:
>
> ----------------------------------------------
> $ gcc HelloWorld.cpp
> /cygdrive/c/DOCUME~1/dAvId/LOCALS~1/Temp/ccEM3ulm.o(.text+0x37):HelloWorld.cpp: undefined reference to `std::cout'
> /cygdrive/c/DOCUME~1/dAvId/LOCALS~1/Temp/ccEM3ulm.o(.text+0x3c):HelloWorld.cpp: 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/dAvId/LOCALS~1/Temp/ccEM3ulm.o(.text+0x65):HelloWorld.cpp: undefined reference to `std::ios_base::Init::Init[in-charge]()'
> /cygdrive/c/DOCUME~1/dAvId/LOCALS~1/Temp/ccEM3ulm.o(.text+0x80):HelloWorld.cpp: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
> collect2: ld returned 1 exit status
>
> Is this normal? With std::cout error?
> I mean, is this from the source code itself?
> To me, the source looks fine, though.
>
> Thank you in advance.
> David

(a) Use 'g++' to link C++ code.
(b) Please start a new thread when switching topics, rather than
continuing old threads.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]