Archived

This topic is now archived and is closed to further replies.

KevinG

Program example from book doesnt work...

Recommended Posts

KevinG    170
Im reading "Tricks of the game programming gurus" or whatever it''s called, and the first example has thrown me for a loop. I put it in verbatim and it doesn''t work at all. Here is the code sample: ----------------------------------- #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <windowsx.h> int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow) { MessageBox(NULL,"There can only be one!","My first windows program",MB_OK | MB_ICONEXCLAMATION); return (0); } ------------------------------------- I get two errors after trying to build this: -------------------------------------------- --------------------Configuration: Cpp3 - Win32 Debug-------------------- Compiling... Cpp3.cpp Linking... LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/Cpp3.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Cpp3.exe - 2 error(s), 0 warning(s) ---------------------------------------------------------------- Im using MSVC++ 6.0. What could the problem possibly be? I cant think of a decent signature right now...try back later...MUCH later.

Share this post


Link to post
Share on other sites
Go to File->New and select ''Win32 Application'', got through all the usual dialog and add your code to the project. Should work fine now, you are probably using the console version at the moment.

HTH

Share this post


Link to post
Share on other sites
Ademan    100
yup...i had the exact opposite problem a while back for my first console app...im a smart one...tried to do win32 app and got the wierdest errors ever..but anyways...go with wut he said

Share this post


Link to post
Share on other sites