sorry in advance for the large chunk of code. Basically when placed in the same file this works fine, but if placed in separate files (and I have tested this) just after Init() is called, the pointer to ID3D10* device's value is suddenly 0x00000000. If it's all in the same file, the device pointer has a memory address all the way through. I'm really stumped here. Also wasn't quite sure whether this was a gamedev or stackoverflow question so sorry if it's in the wrong place. SORRY IN ADVANCE FOR THE AMOUNT OF CODE!

so basically, if I call Init() from game.cpp, the code works fine, if I call cube->init(), just as this function is entered (not when the other one is left), the device pointer suddenly has an address of 0x00000000. Thanks in advance for any help you can give.

You should remove render and cleanup code because it's not relevant to the question. Other code should also be removed, because if you have a null pointer at some line it makes no sense to look into the next lines for the bug, just truncate it from the first exception you get.
–
Pablo ArielSep 24 '11 at 12:33

well I thought I should include it all because I have no idea what the problem is.
–
Asher EinhornSep 26 '11 at 11:58

the trouble is, they're not really initialised. You pass the pointer to specialised methods and these initialise them, but if i make them extern as you say, i get unresolved external symbol errors - i'm assuming because the compiler can't find the definitions.
–
Asher EinhornSep 27 '11 at 12:51

@SirYakalot: That would be correct. As I wrote, the definitions need to be in a .cpp file, although the declarations must be in the header file in order for them to be available to anyone who #includes it. This is so that the linker allocates space for one and only one instance of each of your variables. en.wikipedia.org/wiki/External_variable has an example of this in the "GlobalVariable" variable in its example.
–
Kaz DragonSep 27 '11 at 13:28