c++ win32 some newb errors HELP!

Started by
3 comments, last by Pointer2APointer 11 years, 6 months ago
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
Advertisement
Have you included Windows.h header file?
See my game dev blog: http://gamedev4hobby.blogspot.fi/
You're not including anything in your #include line at the top. Presumably you're missing the appropriate include file for MyRegisterClass and InitInstance.
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...
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."
Yes, this is red text.

This topic is closed to new replies.

Advertisement