Skip to main content
gamedev.net
🔒 Locked

Obj compile Error

Started by StentSoft Mar 3, 2004 at 10:41 AM 1 replies 350+ views
Original Post
StentSoft
StentSoft
Hi, cheers for looking at this I have been using the andypike.com tutorials for directX and am having trouble converting lesson 8 to work as I want it to. http://www.andypike.com/tutorials/DirectX8/008.asp I want the variables: HWND hWnd HINSTANCE hInstance to work in a global file called globals.h, but no matter what I do, I can''t seem to get it to work. Every method I have tried usually results in a compiler error saying it has already been included in the Main.obj file.... Also: I have stripped out all the functionality for the cuboid, as I don''t want it in my program. I have tried passing variables, using pointers etc... but can''t find a way round this and it has been puzzling me for some time. Can anyone suggest what I might do to take these declarations for these variables out of the Terrain and game files and put them into the globals.h file ? Cheers Stentsoft
ajas95
ajas95
have you tried using the extern keyword for the declaration in the .h file? That tells the compiler "I'm using this global, but it's declared somewhere else, so don't make a new copy in memory."

Then you would declare the actual instance (without extern) of it in a cpp somewhere.

[edited by - ajas95 on March 3, 2004 1:40:23 PM]
tailrecursive
tailrecursive
It might be because you dont have an inclusion guard on your globals.h file and you're including it multiple times.


[edited by - tailrecursive on March 3, 2004 11:42:01 PM]
------Yada yada yada

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.