This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Cannot get 'Hello World' to compile
- From: Matthias Andree <matthias dot andree at gmx dot de>
- To: cygwin at cygwin dot com, kjacks2006us at yahoo dot com
- Date: Fri, 28 Aug 2009 15:37:03 +0200
- Subject: Re: Cannot get 'Hello World' to compile
- References: <25188895.post@talk.nabble.com>
ken j schrieb:
> Hi, I am a COMPLETE newby at programming but am trying hard to get as far as
> I can on my own. I have installed Cygwin, with the gcc compiler package, and
> it all seems to be working OK. I'm using the 'Hello World' sample program
> used in the tutorial at cplusplus.com - code is as follows:
>
> // my first program in C++
>
> #include <iostream>
> using namespace std;
>
> int main ()
> {
> cout << "Hello World!";
> return 0;
> }
>
> I have saved the text to file c:\cygwin\hello.c, then from within Cygwin I
> have typed:
> gcc /hello.c -o hello.exe. I get the following error messages:
Cygwin specific:
Install the gcc-g++ package (if you have multiple choices for gcc, install the
same version as the core compiler) and the corresponding libstdc++6 and
libstdc++6-devel packages.
(unless you've already done that - try cygcheck -c -d).
Generic GCC usage:
To compile C++ executables, use g++ to compile (not gcc) so that the front-end
looks for the proper headers and libraries. It is also advisable to call the C++
source files .cc or .cxx rather than .c (using .c makes the front-end believe
you want to compile C, not C++).
HTH
MA
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple