public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* RE: Trouble compiling a C++ Program
@ 2001-11-18 19:42 Andrew Volkov
  2001-11-28  6:36 ` Andrew Volkov
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Volkov @ 2001-11-18 19:42 UTC (permalink / raw)
  To: Matthew Smith; +Cc: cygwin

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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Trouble compiling a C++ Program
  2001-11-18 19:42 Trouble compiling a C++ Program Andrew Volkov
@ 2001-11-28  6:36 ` Andrew Volkov
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Volkov @ 2001-11-28  6:36 UTC (permalink / raw)
  To: Matthew Smith; +Cc: cygwin

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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Trouble compiling a C++ Program
  2001-11-18 10:21   ` Gareth Pearce
@ 2001-11-28  0:47     ` Gareth Pearce
  0 siblings, 0 replies; 10+ messages in thread
From: Gareth Pearce @ 2001-11-28  0:47 UTC (permalink / raw)
  To: cygwin, Craig Sproule

> Hallo Craig,
>
> Am 2001-11-28 um 07:24 schriebst du:
>
> > 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'
>
> > So my question is, how do I get Cygwin to compile this
> > program?
>
> $ g++ -o hello2 hello2.cc
>
> $ hello2
> Welcome to C++!
>
> I remember that if you use the extension .cc, gcc calls g++
> automagically, but it doesn't work.

which is i believe because g++ invoked directly has an implied -lstdc++
if you do gcc -lstdc++ it will also compile just fine.  Ofcourse g++ is
probably a better move for some reason... (other then reduced typing)
>
> Ciao,
>
> Gerrit P. Haase                            mailto:gp@familiehaase.de
> --
> =^..^=
>
>
> --
> 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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Trouble compiling a C++ Program
  2001-11-18 10:21 ` Gerrit P. Haase
  2001-11-18 10:21   ` Gareth Pearce
@ 2001-11-28  0:38   ` Gerrit P. Haase
  1 sibling, 0 replies; 10+ messages in thread
From: Gerrit P. Haase @ 2001-11-28  0:38 UTC (permalink / raw)
  To: Craig Sproule; +Cc: cygwin

Hallo Craig,

Am 2001-11-28 um 07:24 schriebst du:

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

> So my question is, how do I get Cygwin to compile this
> program?

$ g++ -o hello2 hello2.cc

$ hello2
Welcome to C++!

I remember that if you use the extension .cc, gcc calls g++
automagically, but it doesn't work.

Ciao,

Gerrit P. Haase                            mailto:gp@familiehaase.de
-- 
=^..^=


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Trouble compiling a C++ Program
  2001-11-18  4:50 ` Matthew Smith
@ 2001-11-27 22:32   ` Matthew Smith
  0 siblings, 0 replies; 10+ messages in thread
From: Matthew Smith @ 2001-11-27 22:32 UTC (permalink / raw)
  To: Craig Sproule; +Cc: Cygwin

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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Trouble compiling a C++ Program
  2001-11-18  4:26 Craig Sproule
  2001-11-18  4:50 ` Matthew Smith
  2001-11-18 10:21 ` Gerrit P. Haase
@ 2001-11-27 22:24 ` Craig Sproule
  2 siblings, 0 replies; 10+ messages in thread
From: Craig Sproule @ 2001-11-27 22:24 UTC (permalink / raw)
  To: cygwin

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

http://shopping.yahoo.com.au - Yahoo! Shopping
- Get organised for Christmas early this year!

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Trouble compiling a C++ Program
  2001-11-18  4:26 Craig Sproule
  2001-11-18  4:50 ` Matthew Smith
@ 2001-11-18 10:21 ` Gerrit P. Haase
  2001-11-18 10:21   ` Gareth Pearce
  2001-11-28  0:38   ` Gerrit P. Haase
  2001-11-27 22:24 ` Craig Sproule
  2 siblings, 2 replies; 10+ messages in thread
From: Gerrit P. Haase @ 2001-11-18 10:21 UTC (permalink / raw)
  To: Craig Sproule; +Cc: cygwin

Hallo Craig,

Am 2001-11-28 um 07:24 schriebst du:

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

> So my question is, how do I get Cygwin to compile this
> program?

$ g++ -o hello2 hello2.cc

$ hello2
Welcome to C++!

I remember that if you use the extension .cc, gcc calls g++
automagically, but it doesn't work.

Ciao,

Gerrit P. Haase                            mailto:gp@familiehaase.de
-- 
=^..^=


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Trouble compiling a C++ Program
  2001-11-18 10:21 ` Gerrit P. Haase
@ 2001-11-18 10:21   ` Gareth Pearce
  2001-11-28  0:47     ` Gareth Pearce
  2001-11-28  0:38   ` Gerrit P. Haase
  1 sibling, 1 reply; 10+ messages in thread
From: Gareth Pearce @ 2001-11-18 10:21 UTC (permalink / raw)
  To: cygwin, Craig Sproule



> Hallo Craig,
>
> Am 2001-11-28 um 07:24 schriebst du:
>
> > 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'
>
> > So my question is, how do I get Cygwin to compile this
> > program?
>
> $ g++ -o hello2 hello2.cc
>
> $ hello2
> Welcome to C++!
>
> I remember that if you use the extension .cc, gcc calls g++
> automagically, but it doesn't work.

which is i believe because g++ invoked directly has an implied -lstdc++
if you do gcc -lstdc++ it will also compile just fine.  Ofcourse g++ is
probably a better move for some reason... (other then reduced typing)
>
> Ciao,
>
> Gerrit P. Haase                            mailto:gp@familiehaase.de
> --
> =^..^=
>
>
> --
> 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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Trouble compiling a C++ Program
  2001-11-18  4:26 Craig Sproule
@ 2001-11-18  4:50 ` Matthew Smith
  2001-11-27 22:32   ` Matthew Smith
  2001-11-18 10:21 ` Gerrit P. Haase
  2001-11-27 22:24 ` Craig Sproule
  2 siblings, 1 reply; 10+ messages in thread
From: Matthew Smith @ 2001-11-18  4:50 UTC (permalink / raw)
  To: Craig Sproule; +Cc: Cygwin


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/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Trouble compiling a C++ Program
@ 2001-11-18  4:26 Craig Sproule
  2001-11-18  4:50 ` Matthew Smith
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Craig Sproule @ 2001-11-18  4:26 UTC (permalink / raw)
  To: cygwin

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

http://shopping.yahoo.com.au - Yahoo! Shopping
- Get organised for Christmas early this year!

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-11-28 14:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-18 19:42 Trouble compiling a C++ Program Andrew Volkov
2001-11-28  6:36 ` Andrew Volkov
  -- strict thread matches above, loose matches on Subject: below --
2001-11-18  4:26 Craig Sproule
2001-11-18  4:50 ` Matthew Smith
2001-11-27 22:32   ` Matthew Smith
2001-11-18 10:21 ` Gerrit P. Haase
2001-11-18 10:21   ` Gareth Pearce
2001-11-28  0:47     ` Gareth Pearce
2001-11-28  0:38   ` Gerrit P. Haase
2001-11-27 22:24 ` Craig Sproule

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).