This can also occur when you don't compile the program correctly. The first 
response is correct: 
        there is no main function inside the program crt1.o. However, if crt1 is never 
meant to be a "program" 
        (examples would be an object file or library.), then you are fine and can 
ignore the message.

        For example, let's say I am creating an object file (sometimes can be referred 
to as a library). The object file contains popular functions that many of my other 
programs use (let's say the object file is called: my_math_routines). In 
my_math_routines source code I would have functions 
        like "Add" , "Subtract", etc.. my_math_routines will never run as a 
stand-alone program (by itself). 
        However, other programs will call some of these functions (e.g. myprogram.c). 
Therefor what I would 
        do is the following:

        1) Compile my_math_routines.c into an object file (make math_routines.o)
        2) Compile myprogram.c and link in my_math_routines.o

        If in step 1 I did a "make math_routines" (notice how I left out the ".o"), it 
would actually try to create a 
        standalone program called "my_math_routines". However, since this program does 
not have a "main" 
        function (as stated in the e-mail below), I would receive the error you saw 
(main not defined in....). 
        However, I know that that message is OK since I don't want a "math_routines" 
program (just a mistake 
        in my part when I ran the "make" command in step 1.

        Hope this is not too confusing and somewhat helpful.

        -Jim

        ------------------------------

        Message: 8
        From: mark <[EMAIL PROTECTED]>
        Organization: 24.5 Century Productions, unLtd.
        To: [EMAIL PROTECTED]
        Subject: Re: A c programming question?
        Date: Wed, 30 Jul 2003 09:16:57 -0400
        Reply-To: [EMAIL PROTECTED]

        On Wednesday 30 July 2003 06:00 am, 
        > From: reza saeidinia <[EMAIL PROTECTED]>

        > whats the following messages mean:
        > /usr/lib/gcc-lib/i386-redhat-linux/2.96/crt1.o In  function ''_start':
        > /usr/lib/gcc-lib/i386-redhat-linux/2.96/crt1.o(.text+ox18):undefined
        > refrence to 'main' thank you.

        That you're trying to compile a program that has no function named main. Try 
        reading the book (any book, though I prefer K&R), and you'll see that every 
        executable C program *REQUIRES* that the top, first function that is 
        executed when the program runs, and which runs everything else, be named 
        main.

        RTFM

                mark 



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to