This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: cygwin gcc 3.0.4 problem


Oscar Fuentes <ofv@wanadoo.es> writes:

> Pete Barrie <peter@cis.strath.ac.uk> writes:
> 
> > Win2000 Cygwin 1.3.10-1 binutils 2.11.2
> > 
> > Hi. I've just built  3.0.4 native on Cygwin. Build seemed to
> > go fine and I can compile/run C prog hello.c
> > 
> > However  C++ hello.cpp  fails as shown below. Is this something
> > trivial I am missing?
> > 
> > Thanks for any help
> > 
> > Pete
> > 
> > $ cat hello.cpp
> > #include <iostream.h>
> > 
> > int main ()
> > {
> >    cout << "Hello World!";
> >    return 0;
> > }
> > 
> > 
> > 
> > $ gcc -v hello.cpp
> 
> Does it fail with
> 
> $ g++ hello.cpp
> 
> ???
> 
> g++ automatically links the libraries needed by the C++ library. GCC
> not.
> 
> BTW, 
> 
> #include <iostream.h>

This has

using namespace std;
 
> is not standard C++. Use
> 
> #include <iostream>

while this not. So if you use the second form you need to write

std::cout << "Hello World!";

HTH

-- 
Oscar


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