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: Cannot get 'Hello World' to compile

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 - 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++).


Problem reports:
Unsubscribe info:

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