This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Stricter requirements for function main signature
- From: Andrew Haley <aph at redhat dot com>
- To: Ramon Bertran Monfort <rbertran at ac dot upc dot edu>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 08 Apr 2008 09:33:27 +0100
- Subject: Re: Stricter requirements for function main signature
- References: <20080407164106.GA11348@rbertran-workstation>
Ramon Bertran Monfort wrote:
> Hello,
>
> I guess that this is the correct place to ask the following question.
>
> I've built a crosstoolchain for building Cell binaries on a x86 platform.
> The gcc version I used is gcc 4.3.0 . When I compile spu binaries with the
> corresponding main function signature...
>
> main(unsigned long long spe, unsigned long long argp, unsigned long long
> envp)
>
> ... I get an error telling me that the main signature is not correct (the
> first parameters must be and integer, etc...).
>
> spumain.cpp:56: error: first argument of 'int main(long long unsigned int,
> long long unsigned int, long long unsigned int)' should be 'int'
> spumain.cpp:56: error: second argument of 'int main(long long unsigned int,
> long long unsigned int, long long unsigned int)' should be 'char **'
> spumain.cpp:56: error: third argument of 'int main(long long unsigned int,
> long long unsigned int, long long unsigned int)' should probably be 'char
> **'
>
> I've seen in http://www.gnu.org/software/gcc/gcc-4.3/porting_to.html that
> C++ from version 4.3.0 has stricter requirements for function main
> signature. How is supposed to work this on a Cell platform?
Why don't you just define main() correctly? argv should be 'char **',
and envp should probably be 'char **'. How can you possibly have an
envp that's a long long unsigned int?
Also, what are the compiler options you're using?
Andrew.