I was under the impression that header guards solve the problem of redefinition. I'm getting linker errors that say there are redefinitions in the .obj files. This is the header I'm including, the problems are with the redefinition of all the global declarations.
#ifndef DIRECT3D_H
#define DIRECT3D_H
// global declarations
ID3D10Device* device;
ID3D10Buffer* pBuffer;
ID3D10Buffer* iBuffer; // the pointer to the index buffer
ID3D10RenderTargetView* rtv; // the pointer to the render target view
ID3D10DepthStencilView* dsv; // the pointer to the depth stencil view
IDXGISwapChain* swapchain; // the pointer to the swap chain class
ID3D10Effect* pEffect;
ID3D10EffectTechnique* pTechnique;
ID3D10EffectPass* pPass;
ID3D10InputLayout* pVertexLayout;
ID3D10EffectMatrixVariable* pTransform; // the pointer to the effect variable interface
D3D10_PASS_DESC PassDesc;
// function prototypes
void initD3D(HWND hWnd);
void render_frame();
void init_pipeline();
void cleanD3D();
void Init();
#endif
say this header is called 3DClass.h. It is included in 3DClass.cpp. It is also included in another file - a main game loop. Now, I realise there can be problems with header files when there are multiple translation units, but I don't quite understand why this wouldn't be working, i'm only including the header in one file and also in the corresponding source file. shouldn't this be fine?