• Create Account

Visual C++ 6.0 Error Question

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

#1GameDev135  Members

133
Like
Likes
Like

Posted 07 July 2001 - 06:18 PM

I had to brush up on my C++ before I could start doing graphical programming. So I went into Visual C++ 6.0 and started practicing using classes and header files. Suddenly I got this error: LNK2001 unresolved external symbol _winmain@16 I started to wonder what was causing this and went back to the simple HelloWorld program. Now this program was giving me an error too. I found a small way around the problem, but it is very inefficient. (Basically I just make a cpp file to start and then it builds a project instead of the reverse order) I have been through all of the help, etc. and I still dont know how to fix it. Any one have any suggestions? Do you think a file could have somehow become corrupt and I should reinstall? Thanks

#2Martee  Members

476
Like
Likes
Like

Posted 07 July 2001 - 06:36 PM

When you created your project, did you make a Win32 app, or a Win32 console app? If it''s not a console app, you need to use WinMain instead of main.

~~~~~~~~~~
Martee

#3GameDev135  Members

133
Like
Likes
Like

Posted 07 July 2001 - 06:44 PM

Thanks a lot, I now can do it as a console.

However, when I try to do it as a WinApp, it still gives the same error. Additionally, it has a warning:
"WinMain must be _stdCall"
While this isnt important for a program such as helloworld (I can do that in a windows console), this could be important later. I have changed the "main" to "winmain" (with different combinations of capital letters) and it still gives the unresolved external symbol.

What now? Thanks.

#4Martee  Members

476
Like
Likes
Like

Posted 07 July 2001 - 06:50 PM

You need to put WINAPI (or _stdcall, or PASCAL, or APIENTRY, etc.)before WinMain. It should look something like this:
  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow)

~~~~~~~~~~
Martee

#5draqza  Members

122
Like
Likes
Like

Posted 09 July 2001 - 03:49 AM

Yeah, that should fix it. I''m getting ready to release a 3 part series of tutorials on basic windows programming without using the wizard; I''ll post here when it''s ready.
--

WNDCLASSEX Reality;
...
...
Reality.lpfnWndProc=ComputerGames;
...
...
RegisterClassEx(&Reality);

Unable to register Reality...what''s wrong?
---------
Dan Upton