DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main

  1. #1
    Alex Guest

    msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main


    I have just wrote a simple Hello, MFC program from Jeff Prosises book
    "Programming Windows95 with MFC" from 1996. I opened the cpp file, went into
    project settings and specified that it should use shared dlls. It isn't that
    i'm too lazy to read the error messages, but I really don't understand what
    it means...

    --------------------Configuration: Hello - Win32 Debug--------------------
    Compiling...
    Hello.cpp
    Linking...
    msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
    Debug/Hello.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    Hello.exe - 2 error(s), 0 warning(s)


    I hope you see what's wrong... =)

  2. #2
    Carel J. Blumenstock Guest

    Re: msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main


    Hi,
    your program isn't the problem, it's the linker that misses function 'main'.
    This means you are trying to build a console application while your program
    most likely has a WinMain function which means your program is a Win32 application.

    What to do? Recreate the project but specify that you want to create a Win32
    application and your problem is solved,

    Succes,

    Carel

    "Alex" <alex@teinum.net> wrote:
    >
    >I have just wrote a simple Hello, MFC program from Jeff Prosises book
    >"Programming Windows95 with MFC" from 1996. I opened the cpp file, went

    into
    >project settings and specified that it should use shared dlls. It isn't

    that
    >i'm too lazy to read the error messages, but I really don't understand what
    >it means...
    >
    >--------------------Configuration: Hello - Win32 Debug--------------------
    >Compiling...
    >Hello.cpp
    >Linking...
    >msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
    >Debug/Hello.exe : fatal error LNK1120: 1 unresolved externals
    >Error executing link.exe.
    >
    >Hello.exe - 2 error(s), 0 warning(s)
    >
    >
    >I hope you see what's wrong... =)



  3. #3
    Join Date
    Mar 2008
    Posts
    1

    Thumbs up Correct!

    I too am starting to work with MFC and ran across the same issue and your answer to recreate in Win32 Application was on the money. Thank you very much for your reply to the other individual.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center