Re: unreferenced main in embedded source code

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

 



On 20/04/2011 14:28, Ian Lance Taylor wrote:
> domenico margiotta writes:
> 
>> i'm programming for embedded system and for work i use a code warrior
>> ide (for freescale microprocessor).
>>
>> Our client has required to clean every warning in souce code. The
>> codewarrior compiler don't detect every warning and so the client said
>> to use a gcc -Wall and lint command.
>>
>> In our source code,we don't use a classic main(), but we specified at
>> the IDE how is the main() and it compile fine, but when i run gcc
>> -Wall, i reached the error for "undefined reference to `main' ".
>>
>> Is it possible specify my entry point as main()?
> 
> This question is not appropriate for the mailing list gcc@xxxxxxxxxxx,
> which is for GCC developers.  It would be appropriate for the mailing
> list gcc-help@xxxxxxxxxxxx  Please take any followups to gcc-help.
> Thanks.
> 
> The compiler doesn't really care about main.  This is more of a linker
> issue.  If you are just looking for compilation time warnings, and you
> are doing the actual compilation with a different compiler, then I
> wouldn't worry about this.  In general, the way to specify the entry
> point for your program is to use the linker option -e, typically via
> -Wl,-e,mymain.  You will probably also need to use the -nostartfiles
> option.  See the docs for those options (see the linker docs for -e).

  You probably also want to be using the -ffreestanding option.

    cheers,
      DaveK



[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