Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Gotta Problem in Code

This topic is 5650 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

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.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!