Advertisement

Gotta Problem in Code

Started by December 01, 2002 05:30 PM
7 comments, last by Tigra7 21 years, 11 months ago
I wanted to start out by saying how much i love this site and its community. They have helped me out in all my programming mistakes. I have a very small problem in one of my games... I am coding a small program that creates a triangle on the screen in opengl so that a friend can learn from it. I wrote it and got 1 error... after fixing a few misstypes. Well, the problem is one that I have never incountered before. Here is the line of code that is messed up: WndClass.lpfnWndProc = WinProc; The error it recieves is: error C2440: ''='' : cannot convert from ''long (__stdcall *)(struct HWND__ *,unsigned int,long,unsigned int)'' to ''long (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'' This conversion requires a reinterpret_cast, a C-style cast or function-style cast Error executing cl.exe. I have checked and rechecked my code and I can''t seem to figure out what is wrong. Any help would be greatly apreciated.
It sounds like you have your WinProc defined wrong. You have it to taking in the parameters in the wrong order. It should be something along the lines of:

LRESULT WINAPI WinProc( HWND, UINT, WPARAM, LPARAM );

I suspect yours is:

LRESULT WINAPI WinProc( HWND, UINT, WPARAM, UINT);

which is what the error is saying.
Advertisement
Quick guess:
Think you''ve written LPARAM for WPARAM and for the other
one the same thing but the other way around ...
Right on target... mixed up LPARAM and WPARAM..


yet another question answered in these forums for me.

Thanks Guys,

Chris
Well, another problem came up...(I now realize how badly I need to review this stuff.)

The problem was fixed, but it came up with a linking error:

nit.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
Init.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
Init.obj : error LNK2001: unresolved external symbol "void __cdecl Init(struct HWND__ *)" (?Init@@YAXPAUHWND__@@@Z)
Debug/MyTriangle.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.


Again, any help is apreciated.

Thanks,

Chris
Need to link OpenGL32.lib.


[My site|SGI STL|Bjarne FAQ|C++ FAQ Lite|MSDN|Jargon]
Ripped off from various people
[size=2]
Advertisement
I linked it but one linker error still remains.

Init.obj : error LNK2001: unresolved external symbol "void __cdecl Init(struct HWND__ *)" (?Init@@YAXPAUHWND__@@@Z)

thats the only problem left.

[edited by - Tigra7 on December 1, 2002 8:31:47 PM]
Is th Init() function implemented and is the implementation
linked to your project?
Everything is fixed, works nicely. Thanks.

This topic is closed to new replies.

Advertisement