www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/08/15:11:19

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: "HELLO WORLD!" C++ Programming Error with Djgpp?
Date: Sat, 08 Feb 1997 14:01:55 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 33
Message-ID: <32FCF752.5B08@cs.com>
References: <32f55207 DOT 1140784 AT news DOT akula DOT com> <5dejs8$29l AT isis DOT fiu DOT edu>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp104.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

daniel k rathjens wrote:
> [snip]

These instructions are correct, but there is something else wrong with
your program:

> : void main()

void main() is an illegal construct under C++.  main() MUST return an
integer.  Period.  The compiler should give you a warning about this if
you compile with '-Wall'.  It's also extremely bad practice in C.

What manual/teacher/person taught you to use 'void main()'?

> : C:\>gcc hello.cpp -o hello

This is an okay command line, but it's probably better to use the
following:

C:\>gxx -Wall -O -g -o hello.exe hello.cpp

Look up those various options in the gcc docs to see why they are so
useful.

Hope this helps!

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |        fighteer AT cs DOT com         |
| "Starting flamewars since 1993"  |   http://www.cs.com/fighteer   |
|  *** NOTICE ***  This .signature is generated randomly.           |
|                  If you don't like it, sue my computer.           |
---------------------------------------------------------------------

- Raw text -


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