ok, that might explain it, ive got a copy of Vis C++ on my bosses computer, ill jump on here as soon as he leaves and test it out. ive been putting both my protoyes and implementations in the header files, i have a nasty feeling that that is a portion of my problem, anyway, thank you and ill let ya know when i get it sorted out.
edit ** ok, i just built a cpp file and a header file, declared my header file and all of the variables where available, weird.
Maybe it has something to do with the fact that the D3DDEVICE is an object as opposed to a first level type. i dont know guys, anyway thanks for your help.
VB programmer, struggling with Cpp
//globals.hextern int g_CrudeAsHell;//globals.cpp#include "glboals.h"int g_CrudeAsHell;//any_other.cpp#include "globals.h"void do_stuff(){if(g_CrudeAsHell==0) { //stuff g_CrudeAsHell=1; }}
You declare the variable to be ''extern''al in the header that all the cpp files include. In one (and exactly one) cpp file, you need to actually set aside space for the variable (I do this in the global.cpp file.) Then it''s the linker''s job to hook all the references to g_CrudeAsHell together.
You can precompile global.cpp into a static library, then link to that library instead of compiling global.cpp every time. Not a big deal for a couple of globals, but useful for something as large as, say, DirectX.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement