www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/25/03:11:06

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: QUESTION: General Syntax
Date: Mon, 24 Feb 1997 21:42:18 -0800
Organization: Alcyone Systems
Lines: 31
Message-ID: <33127BBA.410082D5@alcyone.com>
References: <Pine DOT SOL DOT 3 DOT 91 DOT 970224190743 DOT 3403A-100000 AT world DOT evansville DOT net>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Zaphod Beeblebrox wrote:

> I'm still really new to C/C++, but I was on a good steady track using the
> Personal C Compiler from C WARE.  The general syntax I'm used to doesn't
> apply in GCC.  Here is what I'm used to:
> 
> main();
> {
> puts("Hello World.");
> return(0);
> }
> 
> Why won't this compile?

You have an extraneous semicolon at the end of your definition of the
function main.  What the compiler thinks you're doing based on your bad
syntax is declaring a prototype for function main, and then starting a
block that isn't part of any function.

> I get an unusual parser error at the first {.
> How do I fix this?

Remove the semicolon.

-- 
       Erik Max Francis, &tSftDotIotE / email:  max AT alcyone DOT com
                     Alcyone Systems /    web:  http://www.alcyone.com/max/
San Jose, California, United States /    icbm:  37 20 07 N  121 53 38 W
                                   \
              "I am become death, / destroyer of worlds."
                                 / J. Robert Oppenheimer (quoting legend)

- Raw text -


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