-
linking error...
--------------------Configuration: roll_dice_roll - Win32 Debug--------------------
Compiling...
main_game.cpp
randgen.cpp
Linking...
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...?
-
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.
-
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.