Re: GCC: Compilation using C/C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 02:07 18.02.2008 -0300, Ricardo Sardano Guanciale wrote:
>My name is Ricardo, please can you help me?
>
>How can I compile the following ANSI C code without warnings:
>
>#include <stdio.h>
>
>void main(void)
>{
>    printf("Hello world!\n");
>}
>
>I tryed:
>
>gcc helloworld.c -o helloworld
>
>The compiler answered:
>
>helloworld.c: In function `main':
>helloworld.c:4: warning: return type of 'main' is not `int'

You need to declare it:

int main(void)
{
        return 0;
}

This return value is used for the exit code of the program.

bye  Fabi



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux