PDA

View Full Version : hInstance error when compiling.



agent 007
10-31-2005, 06:03 PM
Hey!

I am working on an OGL FPS game engine, and right now it's in its very early stages. Hence, all I have done is the OGL window. But, every time I compile I get these errors when compiling:

c:\Program Files\Elemental Fire\Elemental Fire.cpp(90) : error C2065: 'hInstance' : undeclared identifier
c:\Program Files\Elemental Fire\Elemental Fire.cpp(93) : error C3861: 'hInstance': identifier not found, even with argument-dependent lookup
c:\Program Files\Elemental Fire\Elemental Fire.cpp(113) : error C3861: 'hInstance': identifier not found, even with argument-dependent lookup
c:\Program Files\Elemental Fire\Elemental Fire.cpp(118) : error C3861: 'hInstance': identifier not found, even with argument-dependent lookup
c:\Program Files\Elemental Fire\Elemental Fire.cpp(184) : error C3861: 'hInstance': identifier not found, even with argument-dependent lookup

I am using Visual Studio.net 2003 on Windows XP.

Thanks
Sincerely
Agent 007.

john
10-31-2005, 09:51 PM
Hi,

you need to create an object named hInstance. If I was a betting man, I'd guess you'd want to declare it in your WinMain prototype, like so:

http://msdn.microsoft.com/library/defaul...ons/winmain.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/winmain.asp)

p.s. I respect your ambition to write your Gabriel FPS game--seriously and honestly, I do--but I strongly encourage you to learn how to programme in C/C++ _first_ before you get too carried away with learning OpenGL as well.

There is a lot to learn in how to write programmes and it'd be easier to narrow your scope while you learn the fundemental issues in writing programmes. It'll make working out bugs in your understanding a _lot_ simpler. For example, if you are learning both C/C++ and OpenGL and you end up with a black screeen, then you might be unsure whether your linked list traversal code is correct (because you don't have a firm understaning of pointers, for instance), or whether your OpenGL context is wrong; but if you're strong with the ways of the programming, then you can readily rule out linked list errors and concentrate on your context errors.

I don't know. Maybe you'll find it easy to learn both simultaneously, but then that's a pretty steep learning curve. Learning to divide and conquer a problem into smaller problems, learning tools of constructing solutions like using storage containers such as stacks, doublly linked lists, priority queues, sorting algorithms, searching algorithms, how to use recursion and structure your data-types can all be done without worrying about the myriad of problems associated with rendering.

good luck, with your learning and your game ambitions.

cheers
John