Stricter requirements for function main signature

Andrew Haley aph@redhat.com
Tue Apr 8 10:22:00 GMT 2008


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.



More information about the Gcc-help mailing list