Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!sci.kun.nl!atcmpe!leo From: leo@atcmp.nl (Leo Willems) Newsgroups: comp.lang.c++ Subject: Re: Can you prototype main() ????? Message-ID: <659@atcmpe.atcmp.nl> Date: 17 Sep 90 09:30:56 GMT References: <14227.26dc5b2f@max.u.washington.edu> Organization: AT Computing, Nijmegen, The Netherlands Lines: 27 From article <14227.26dc5b2f@max.u.washington.edu>, by 8324155@max.u.washington.edu: > > > > I'm hoping someone can help me with this (hopefully) easy question > about C++, and specifically Turbo C++. I have been learning C++ and using > the book "C++ Techniques and Applications" by Scott Robert Ladd, and when > I tried to compile one of his example programs with Turbo C++ I got a > "cannot overload 'main'" error message. It seems the compiler choked on > the author prototyping main (with the line: int main(); > Is this a problem with Turbo C++, or is it not allowed in C++ and the > compiler that the author used just accepted it ? It works fine in Turbo > if I remove the prototype. > > Thanks ahead of time, Mark Frey The annotated C++ ref man (E&S) is very explicit about main, amongst others it states: main() can not be overloaded and its calling conventions are implementation dependent, but two forms are recommended: main() and main(int, *char[]) So, however not stated explicitlly, as I see it you are not allowed to give a prototype for main. Hope this helps. Leo