Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Martin Wuerthner Newsgroups: comp.sys.acorn.programmer Subject: Re: A !GCC-compiler question (C++) Date: Mon, 22 Aug 2011 20:00:12 +0200 Organization: MW Software Lines: 36 Message-ID: <583fdd0652.martin@bach.planiverse.com> References: <66eece0652.noreply@chiemgau-net.de> <4e527a31$0$18803$ba4acef3@reader.news.orange.fr> X-Trace: individual.net OrjfeIS/rG1NzXftIfjNIAbSEYwAQNAMftCS1G0svUm6S0j4iW X-Orig-Path: bach.planiverse.com%martin Cancel-Lock: sha1:J2jqHbuQTvKBYmLGW4v1j2S8yTQ= X-Editor: EmailEdit 6.00 User-Agent: Messenger-Pro/6.00 (MsgServe/6.00) (RISC-OS/5.16) NewsHound/v1.50-32 Xref: x330-a1.tempe.blueboxinc.net comp.sys.acorn.programmer:650 In message <4e527a31$0$18803$ba4acef3@reader.news.orange.fr> Rick Murray wrote: > On 22/08/2011 17:23, Alexander Ausserstorfer wrote: >> #include > Shouldn't that be ? No. The C++ STL headers should be included without a ".h" suffix. >> using namespace std; >> void main() >> { >> cout<< "Hello World!"<< endl; >> } >> >> Using the GCC-compiler (4.1.1) for RISC OS doesn't work: >> >> *gcc cpp.test -o test >> test.cpp:1:20: error: iostream: No such file or directory >> test.cpp:3: error: '::main' must return 'int' > Seems a strange requirement... Not really strange. The return value is required as the exit code for the calling OS. In contrast to C, which merely has undefined behaviour for "void main()", the C++ actually enforces an 'int' return type. -- Martin --------------------------------------------------------------------- Martin Wuerthner MW Software http://www.mw-software.com/ RISC OS Software for Design, Printing and Publishing ---------------------------------------------------------------------