View Full Version : NeHe base code error

02-03-2001, 10:10 AM
When I try to compile the NeHe base code for window creation I get the following error:

The line of code:
wc.lpfnWndProc = (WNDPROC) WndProc;

The error:
'type cast' : cannot convert from '' to 'long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'

None of the functions with this name in scope match the target type

Could someone please help?

02-03-2001, 05:38 PM
You sure that is the line with the error?

That looks OK.
What compiler you using?

02-04-2001, 03:41 PM
I am using VC++ 6.0 with SP2. It used to work. I didn't change anything really essential. I just added some drawing stuff to the DrawGLScene() function and it quit working.

02-05-2001, 04:50 AM
Does anybody know what my problem is?

02-05-2001, 07:26 AM
Well, from the looks of your error message WNDPROC is undefined. Have you tried doing Build->Clean and then remaking everything? The only reason why I can think that WNDPROC would be undefined would be if Windows.h wasnt included (unlikely or you'd get alot more errors) or if you using precompiled headers and things got wacky.
Assuming that remaking everything doesnt work, what happens if you remove all the code you added? (just '#if 0' it out). If that solves the compilation problem and you cant find anything wrong with your code, post the changes.

02-05-2001, 11:21 AM
This may be too obvious to be the problem, but did you name your WindowProc function WndProc?

02-05-2001, 03:55 PM
Yes, I named my function WndProc just like NeHe had it in Tutorial #1.