undefined reference to main error in SDL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kumarangopi
    New Member
    • Nov 2006
    • 3

    #1

    undefined reference to main error in SDL

    Iam working with graphics.I wrote a pgogram in turbo c for graphics.I need to run on Freebsd system, so installed SDL and trying.when i give make in sdl_image folder
    /usr/lib/crt1.o undefined reference to main error is giving

    i tried to located crt1.c,i found 5 places,i modified all the files by adding
    i
    program found with main like this:
    extern int main(int,char **,char **);
    ......
    ....
    .....
    exit(main(argc, argv,env));
    here i added after commenting the extern int main line
    in main(int argc,chart **,chart **)
    {
    }
    still same error,someone help me please,iam stucked
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    1. You shouldn't edit crt1.c, you shouldn't need to edit it either. It is part of the start-up code for your system. Additionally crt1.c may only be there for reference, I doubt it is compiled when you create your program you will still be using the pre-compile binary that was from the original source code.

    2. The unresolved reference to main you are getting indicates that you program does not contain the function

    int main(int argc, char ** argp)
    {
    ...
    }

    This function should appear in your code somewhere and is the standard entry point for any C/C++ program.

    Comment

    Working...