Advertisement

VC++6.0 unresolved external symbol _main?

Started by April 24, 2002 12:37 PM
22 comments, last by Fuzztrek 22 years, 10 months ago
heh.. it still doesn''t work... just to let you know i have windows xp..

¬_¬
Why don''t you zip your project and put it up somewhere? If you are using MSVC6, I''ll look at it.
---visit #directxdev on afternet <- not just for directx, despite the name
Advertisement
Hi,

I am a newbir to VC++ too. And these problems happened with me too. I am not sure wether its the same case or not. Well, let me tell u any way...

You are trying to create a Win32 Application. Have u ever created a Hello World app. Sometimes the same app. u have written will work and sometimes will not. Use this instead:

// For registering WNDCLASSEX Structure
ATOM WinClass_Register(HINSTANCE hInstance)

// For creating the Window
BOOL WinClass_Create(HINSTANCE hInstance, int nCmdShow)

// Rest are the same old. for WinMain()

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

// Message Handler

LRESULT CALLBACK WinProc(HWND hWnd, UINT WinMsg, WPARAM wParam, LPARAM lParam)

Now your WinMain() should be small. These should be your first line in WinMain():

WinClass_Register(hInstance);

if(!WinClass_Create(hInstance, nCmdShow))
{
return FALSE;
}

rest is the same. Now in WinClass_Register(), fill up the WNDCLASSEX structure and return RegisterClassEx(); In WinClass_Create() create window by CreateWindowEx().

Well now u wont get an error this time.

But a piece of Warning. This code is error free, but might not work in other compilers like Dev-C++.

And other one I figured out is if u run the app. and doesn't see any Window. Press Ctrl+Alt+Del. You will see it running in the background there. Just select them and press EndTask. Then delete it and compile and execute again.

One more thing. A few of u guys donno difference b/w WINAPI and PASCAL. These are for handling the messages que. OK here it is.

WINAPI: It means first come first serve.

PASCAL: It means the last one will be first serve and the first one will be served last.

OK! It was a long one. But I hope I made myself clear and helped u guys.

Thanks

I ... am ... the GAME!!!

[edited by - The Lion King on April 24, 2002 9:02:13 PM]
oops. never mind. spelling mistake.. eheh. boy do i feel stupid, and I bet you''d agree that I am.. ehhe. oh well.. 22 posts of newbish stupidity...

¬_¬

This topic is closed to new replies.

Advertisement