Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Need a little help with something :-)

I am currently reading a book (Game Programming all in One) one programming. IM stuck because it's got me trying to build a small program consisting of more than one file but IM getting this error but I don't how to fix the problem. Here, take a look at the error message.

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

Multiple Files Program.exe - 2 error(s), 0 warning(s)

Comments

  • kc2keokc2keo Posts: 110Member
    : Linking...
    : LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    : Debug/Multiple Files Program.exe : fatal error LNK1120: 1 unresolved externals
    : Error executing link.exe.
    :
    : Multiple Files Program.exe - 2 error(s), 0 warning(s)

    Ok. This is a linkage error. Since I dont know what compiler your using I will attempt to reply to this accuratly.

    You must link LIBCD.lib into your project. WinMain looks like your trying to link a winsock program. If so I had the same problem

    Here is the reply I got:
    http://forums.devshed.com/t111942/s.html

    I needed to link that needed file so I made a new project and since I already had ms visual c++ I found the needed library and added it and Success!

    If you dont have that library I could email you that library.

    Bye,
    George

    <------------------------------------------>

    Reach me at:

    AIM IM: kc2keo
    EMAIL: kc2keo@yahoo.com

  • chick80chick80 Posts: 349Member
    : : Linking...
    : : LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    : : Debug/Multiple Files Program.exe : fatal error LNK1120: 1 unresolved externals
    : : Error executing link.exe.
    : :
    : : Multiple Files Program.exe - 2 error(s), 0 warning(s)
    :

    You're creating a Win32 project, so the linker expectes WinMain, not main.
    If you want to use main, just create a console project, that's all!

    nICO

    [hr]
    [italic]How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • kc2keokc2keo Posts: 110Member
    wouldnt you also have to include a library into your project. WS2_32.lib maybe or is that only for winsock.

    <------------------------------------------>

    Reach me at:

    AIM IM: kc2keo
    EMAIL: kc2keo@yahoo.com

  • chick80chick80 Posts: 349Member
    : wouldnt you also have to include a library into your project. WS2_32.lib maybe or is that only for winsock.
    :
    : <------------------------------------------>
    :
    : Reach me at:
    :
    : AIM IM: kc2keo
    : EMAIL: kc2keo@yahoo.com
    :
    :
    Well, I don't know about winsock (never used), but that type of error is quite common... (if you search the forums on this site you'll find lots of posts about it) and the solution is simply what I said.

    Btw, it's the same of writing a Win32 app and linking it as a console program: the linker will fail searching for main.

    nICO

    [hr]
    [italic]How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


Sign In or Register to comment.