我的印象是标题守卫解决了重新定义的问题.我收到链接器错误,说明.obj文件中有重新定义.这是我所包含的标题,问题在于重新定义所有全局声明.
#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 …Run Code Online (Sandbox Code Playgroud)