I'm writing a little DirectX model viewer.
I just finished writing my scene manger.
I will only ever have 1 scene manger object so my idea was to create a global pointer of type "scnManger" and then set it when i create my scene manger object.
This would let me get to it from any where in my application.
I'm getting a compile error though:
1>shaderViewer.obj : error LNK2005: "class scnManger * sceneManger" (?sceneManger@@3PAVscnManger@@A) already defined in sceneManager.obj
1>C:\Users\Greg\Documents\Visual Studio 2010\Projects\ShaderViewer\Debug\ShaderViewer.exe : fatal error LNK1169: one or more multiply defined symbols found
right now I have 3 files
sceneManger.h:
// Our global scene manger variable
scnManger* sceneManger;
shadherViewer.cpp (winMain & includes sceneManger.h):
scnManger shaderViewerScnManger;
sceneManger = &shaderViewerScnManger;
sceneManger.cpp (includes sceneManger.h):
I use the methods of my scene manger object in here for various things.
First I would like to understand why I am getting the error, and am also open to any suggestions about a better way to handle this. I wasn't sure if using a global variable like this was a good idea or not.