Jump to content

View more

Image of the Day

The beast has a mighty searchlight of evil! #screenshotsaturday https://t.co/bzKepOojDL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

c++ win32 some newb errors HELP!

4: Adsense

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.


  • You cannot reply to this topic
4 replies to this topic

#1 Assassinbeast   Members   

271
Like
0Likes
Like

Posted 09 October 2012 - 07:29 AM

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.Posted Image

Someone help me with this thanks Posted Image

#2 JiiPee   Members   

135
Like
0Likes
Like

Posted 09 October 2012 - 07:54 AM

Have you included Windows.h header file?
See my game dev blog: http://gamedev4hobby.blogspot.fi/

#3 PyroDragn   Members   

404
Like
0Likes
Like

Posted 09 October 2012 - 08:00 AM

You're not including anything in your #include line at the top. Presumably you're missing the appropriate include file for MyRegisterClass and InitInstance.

#4 Assassinbeast   Members   

271
Like
0Likes
Like

Posted 09 October 2012 - 08:20 AM

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...

#5 Pointer2APointer   Members   

287
Like
0Likes
Like

Posted 09 October 2012 - 03:05 PM

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.




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.