Thread: Compiler error, just can't seem to figure it out.

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    16

    Compiler error, just can't seem to figure it out. [Solved]

    here it is:
    Code:
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/3D Car.exe : fatal error LNK1120: 1 unresolved externals
    Seems to occur at the end of the compiling stage when it starts the linker.exe
    Last edited by Skynet-systems; 04-08-2005 at 02:27 PM.

  2. #2
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    That usually means that you have a function declared in another file, but it's never defined.

  3. #3
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Do you always have this problem compiling programs? If so, perhaps you have a library in the wrong place.

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by Skynet-systems
    Code:
    LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/3D Car.exe : fatal error LNK1120: 1 unresolved externals
    This?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Chief Code Coloniser!
    Join Date
    Apr 2005
    Posts
    121
    Most of the time this error occurs when creating a windows application (ie. using WinMain()), but your project settings are for a console application (ie. looks for main()).

    If you use something like Visual C++, you'll simpley have to create a new project and make sure you specify a "Win32 Application", and not a console application.

    If you are creating a console application, make sure you've correctly specified the prototype for your main() function

    Code:
    int main(void)
    {
       // your code here
    }
    Hope that helps!

    [Edit: DOH! Beaten to it again ]

  6. #6
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Yep, for me that always means a missing main function, usually when I'm checking for errors in functions and haven't written a main yet. Are you running a console app or windows app?

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    16
    Thanks, got it fixed. Your all so much help, me loves this site

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  2. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 11:07 AM
  3. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 06:42 AM
  4. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM
  5. Help With finding a compiler
    By macman in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 04-15-2005, 08:15 AM