This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
RE: Trouble compiling a C++ Program
- From: Andrew Volkov <Andrew dot Volkov at transas dot com>
- To: Matthew Smith <matts at bluesguitar dot org>
- Cc: cygwin at sources dot redhat dot com
- Date: Wed, 28 Nov 2001 17:36:00 +0300
- Subject: RE: Trouble compiling a C++ Program
Try
g++ Welcome.cpp -o Welcome.exe
or
gcc Welcome.cpp -o Welcome.exe -lstdc++
Regards
Andrey Volkov
> -----Original Message-----
> From: Matthew Smith [mailto:matts@bluesguitar.org]
> Sent: Wednesday, November 28, 2001 9:32 AM
> To: Craig Sproule
> Cc: Cygwin
> Subject: Re: Trouble compiling a C++ Program
>
>
>
> Use g++ to compile it, not gcc.
>
> cheers,
> -Matt
>
>
> > To Cygwin gcc gurus,
> >
> > I have downloaded the latest version of CygWin. When I
> > compile the following C++ program:
> >
> > ----------------------------------------
> >
> > // Filename: Welcome.cpp
> > // A first program in C++
> > #include <iostream.h>
> >
> > int main()
> > {
> > cout << "Welcome to C++!\n";
> >
> > return 0;
> > }
> >
> > ----------------------------------------
> >
> > gcc pops out the following error:
> >
> > ----------------------------------------
> > welcome.cpp: undefined reference to `cout'
> >
> > welcome.cpp: undefined reference to
> > `ostream::operator<<(char const *)'
> > collect2: ld returned 1 exit status
> >
> > ----------------------------------------
> > I have been using Cygwin for a while, and have
> > compiled more complex programs than this on it before.
> >
> > So my question is, how do I get Cygwin to compile this
> > program?
> >
> > Regards
> > Craig Sproule
>
>
>
> --
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting: http://cygwin.com/bugs.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/