[cfe-dev] error when using "int32_t main (int32_t argc, char * argv[])"

Richard Smith richard at metafoo.co.uk
Thu Oct 3 14:45:40 PDT 2013


On Thu, Oct 3, 2013 at 3:52 AM, Robert Lytton <robert at xmos.com> wrote:

>  Hi,
>
> I'm trying to get the 'test-suite' running using clang as a cross compiler
> for XCore.
>
> However I have hit the following problem:
>
>     clang++ -c
> llvm-test-suite/MultiSource/Applications/ALAC/decode/main.cpp --target=xcore
>     llvm-test-suite/MultiSource/Applications/ALAC/decode/main.cpp:72:1:
> error: 'main' must return 'int'
>     int32_t main (int32_t argc, char * argv[])
>     ^
>     llvm-test-suite/MultiSource/Applications/ALAC/decode/main.cpp:72:9:
> error: first parameter of 'main' (argument count) must be of type 'int'
>     int32_t main (int32_t argc, char * argv[])
>             ^
>     2 errors generated.
>
>
> However, running without the " --target=xcore" and all is fine.
>
> The simple solution for me is to change 'int32_t' to 'int' in the two
> problematic files' main functions viz:
>     llvm-test-suite/MultiSource/Applications/ALAC/decode/main.cpp:int32_t
> main (int32_t argc, char * argv[])
>     llvm-test-suite/MultiSource/Applications/ALAC/encode/main.cpp:int32_t
> main (int32_t argc, char * argv[])
> N.B. The use of int32_t is fine in the rest of the file (stdint.h is
> available).
>
> Does anyone know what the problem is, and what is the correct solution?
>

The problem is that 'main' is required to take a parameter of type 'int'
and return a value of type 'int', and 'int32_t' is not necessarily 'int'.
The correct solution is to fix the code to use the right types, as you
suggested.


> Thank you
>
> Robert
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131003/2f54aa04/attachment.html>


More information about the cfe-dev mailing list