X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=BAYES_00,FORGED_YAHOO_RCVD,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <25188895.post@talk.nabble.com> Date: Fri, 28 Aug 2009 05:17:36 -0700 (PDT) From: ken j To: cygwin AT cygwin DOT com Subject: Cannot get 'Hello World' to compile MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 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: /hello.c:3:20 iostream: No such file or directory /hello.c:4: error: parse error before "namespace" /hello.c:4: warning: data definition has no type or storage class /hello.c: In function 'main': /hello.c:8: error: 'cout' undeclared (first use in this function) /hello.c:8: error (Each undeclared identifier is reported only once /hello.c:8: error for each function it appears in.) After searching for some answers with Google and this forum, I found several others having similar problems. The suggested answers for them did not work for me. One suggested solution was that the iostream library was not installed. I installed the ENTIRE 800 mb Cygwin package, including all libraries. Another suggestion was that it was a pathing issue. I do think I have a pathing issue, or I wouldn't have to use the leading '/' before hello.c - I should be able to use: gcc hello.c -o hello.exe. But I don't know what else to do about the pathing - I added C:\Cygwin, and C:\Cygwin\home\username\ to my set path environment variable and rebooted Win XP Pro SP3. The reason I said Cygwin seems to be working OK is that this other program works correctly (taken from Cygwin's User's guide): http://cygwin.com/cygwin-ug-net/setup-maxmem.html main() { unsigned int bit=0x40000000, sum=0; char *x; while (bit > 4096) { x = malloc(bit); if (x) sum += bit; bit >>= 1; } printf("%08x bytes (%.1fMb)\n", sum, sum/1024.0/1024.0); return 0; } It both compiles and executes properly. If someone could help straighten me out on this, I'd love to move past step one in learning how to program! Thank you, Ken -- View this message in context: http://www.nabble.com/Cannot-get-%27Hello-World%27-to-compile-tp25188895p25188895.html Sent from the Cygwin list mailing list archive at Nabble.com. -- 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