This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: compile bunch of file in gcc


I know but this is from a book.
BTW, thank you.

On Sun, Feb 5, 2012 at 11:57 AM, Kai Ruottu <kai.ruottu@wippies.com> wrote:
> 3.2.2012 22:56, esmaeil mirzaee kirjoitti:
>
>> thanks for your reply.
>> I read your document but unfortunately It doesn't help more.
>>
>> When I compile DieWithError.c I've got below error:
>>
>> $ gcc -o DieWithError DieWithError.c
>> /usr/lib/gcc/i686-linux-gnu/4.4.5/../../../../lib/crt1.o: In function
>> `_start':
>> (.text+0x18): undefined reference to `main'
>> collect2: ld returned 1 exit status
>
>
> Yes, every executable made in C and C++ needs the 'main()' function
> in Unix/console-apps, in Win32 GUI apps that would be 'WinMain()'...
> So you must provide this. The functions in your 'DieWithError.c' seem
> to be only subfunctions, expected to be called from some main program.
>
> The chapter 3 "The form of a C program" in the tutor book should tell
> this thing.



-- 
Best
Esmaeil
https://sites.google.com/site/esmaeilmirzaee


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]