Thread: linking error...

  1. #1

    linking error...

    --------------------Configuration: roll_dice_roll - Win32 Debug--------------------
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/roll_dice_roll.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    What would cause this error? I'm a student and this is my first year in programming so I have no idea. Can anyon help?Please...?

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Northern Virginia/Washington DC Metropolitan Area
    Looks like you have set up your project as a Win32 Application. Create a new project and select Win32 Console Application instead this time. Then add your source file to this new project. When you create a Win32 Application, your linker is going to be looking for a WinMain function as a starting point in your code. If you select Win32 Console Application, then it looks for the main function as a starting point. You use Console Applications if you just need a quick and dirty interface to your program. The other one is for when you have more experience and want a windows interface with forms and buttons and menus and all that.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    If you don't want to have to make a whole new project just because of that, there is a manual way to edit the settings:

    Go to the Project menu, then click Settings.
    Click the Link tab.
    Under project options you'll see a bunch of *.lib file names. After that should be "/nologo /subsystem:windows"
    Change this to "/subsystem:console"

    This tells the VC++ linker that you are not trying to make a normal windows application (which always contains WinMain, not main()) but a simple console application.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 01:10 AM