delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/28/09:37:21

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4A97DD7F.4050501@gmx.de>
Date: Fri, 28 Aug 2009 15:37:03 +0200
From: Matthias Andree <matthias DOT andree AT gmx DOT de>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, kjacks2006us AT yahoo DOT com
Subject: Re: Cannot get 'Hello World' to compile
References: <25188895 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <25188895.post@talk.nabble.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019