delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/17/15:59:22

From: Rodeo Red <rodeored AT netstep DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: return type for `main' changed to `int'
Date: Sun, 17 Oct 1999 13:45:14 -0400
Organization: Church of Evangelical Environmental Extremism
Lines: 105
Message-ID: <537F33663CE4A44F.114FA00648992527.86AA6D9428718DA3@lp.airnews.net>
X-Orig-Message-ID: <380A0B28 DOT 2D6A5A75 AT netstep DOT net>
References: <84EFC73E5BDD300C DOT 85A7FCC32BD1270B DOT F7CB654E8161FA9A AT lp DOT airnews DOT net> <3809FC6D DOT DF9775D6 AT earthlink DOT net>
Abuse-Reports-To: support at netstep.net to report improper postings
NNTP-Proxy-Relay: library2.airnews.net
NNTP-Posting-Time: Sun Oct 17 12:44:58 1999
NNTP-Posting-Host: !dH1>-@[/6f]*>3 (Encoded at Airnews!)
Mime-Version: 1.0
X-Mailer: Mozilla 4.5 [en] (Win98; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


Martin Ambuhl wrote:

> Rodeo Red wrote:
> >
> > I got very frustrated and erased djgpp. Now I'm starting over with the
> > newer version. I've decided not to use rhide until I can get djgpp to
> > work without rhide.
> >
> > This command line:
> >
> >   gcc -c -Wall hello.cpp
>     ^^^
> This should be gpp (or g++ or gxx, depending on installation)
> or hello.cpp should be renamed hello.c
> or you should explicitly link the standard c++ libs

This is what the readme1st says :

To compile a C or C++ source file into an object file, use this
command line:

 gcc -c -Wall myfile.c  (for C source)
  or
 gcc -c -Wall myfile.cc (for C++ source)

I don't understand why you say one thing and the readme1st says another.
Is the read me 1st wrong ?



>
>
> >
> > is supposed to produce the object file hello.o, but doesn't . Instead I
> > get this message:
> > hello.cpp:4: return type for `main' changed to `int'
>
> You left out the word "Warning".  It is significant.
>

No I didn't leave it out. this is the input and the output exactly as it
happens :
C:\djgpp>gcc -c -Wall hello.cpp
hello.cpp:4: return type for `main' changed to `int'




>
> >
> > What does this mean ?
>
> I means gcc turned your illegal code into legal code.
>

and also failed to make an object file for some reason I don't understand. So
if there is no object file where do these changes take place ? In a temporary
file somewhere ?

>
> >
> > here is hello.cpp:
> >
> > #include <iostream.h>
> >
> >    void main ()
> >       {
> >              cout <<"Hello world!\n";
> >                 }
> >
> > ----------------------------------------------------------------
> > What happened when I went to the faq:
> >
> > I searched for "return type for `main'" - no results
> > I searched  for "return type"- found section 22.24 "What should the main
> > function return in a C program? "
> > Does not seem to apply because I'm using C++
>
> In C++ as well, main returns an int.
>

It should say that in that section of the faq then, right ?

Another question. 22.24 says  :  A: The ANSI/ISO C Standard specifies that the
main function be declared in one of the following two ways:
      int main (void);

I don'tunderstand what is being said . Do I change
void main ()
to
int main (void);
or
int main (void);()
?

>

Thanks for helping.

Red



- Raw text -


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