| delorie.com/archives/browse.cgi | search |
| From: | Martin Ambuhl <mambuhl AT earthlink DOT net> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: return type for `main' changed to `int' |
| Date: | Sun, 17 Oct 1999 12:42:21 -0400 |
| References: | <84EFC73E5BDD300C DOT 85A7FCC32BD1270B DOT F7CB654E8161FA9A AT lp DOT airnews DOT net> |
| X-Posted-Path-Was: | not-for-mail |
| X-Accept-Language: | en |
| X-ELN-Date: | 17 Oct 1999 16:40:59 GMT |
| X-ELN-Insert-Date: | Sun Oct 17 09:45:15 1999 |
| Organization: | Nocturnal Aviation |
| Lines: | 55 |
| Mime-Version: | 1.0 |
| NNTP-Posting-Host: | dialup-209.244.101.114.newyork2.level3.net |
| Message-ID: | <3809FC6D.DF9775D6@earthlink.net> |
| X-Mailer: | Mozilla 4.7 [en] (Win95; U) |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
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
>
> 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.
>
> What does this mean ?
I means gcc turned your illegal code into legal code.
>
> 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.
--
Martin Ambuhl mambuhl AT earthlink DOT net
__________________________________________________________
Fight spam now!
Get your free anti-spam service: http://www.brightmail.com
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |