• Advertisement
Sign in to follow this  

c++ win32 some newb errors HELP!

This topic is 1932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone.

I just bought Jonathan S. Harbours book called Beginning Game Programming Third Edition.
And already in the beginning... i get two errors that says identifier not found.

[source lang="cpp"]#include <Windows.h>

int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;

MyRegisterClass(hInstance);

if(!InitInstance (hInstance, nCmdShow)) return FALSE;

while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}[/source]

Its the "MyRegisterClass" and "InitInstance" i get the red line below the text, and it says identifier not found.
Im using vc++ express 2010 and im sure i made everything correct according to the book so far.wacko.png

Someone help me with this thanks smile.png

Share this post


Link to post
Share on other sites
Advertisement
You're not including anything in your #include line at the top. Presumably you're missing the appropriate include file for MyRegisterClass and InitInstance.

Share this post


Link to post
Share on other sites
no no... i have included it.
But i figured out what the problem was.... it was because that the program was not finished yet, so i thought i could debug and run it, but he continued the program after 1 chapter...

Share this post


Link to post
Share on other sites
You can't invoke a function from a function if it isn't defined yet before scope enters that particular function call(in C++, for this predicament).

MyRegisterClass() has to be defined above for it to work. Same with the other function.

"Identifier not found" is the compiler's way of saying "This function call doesn't exist from this scope yet."

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement