Hi here, here's the situation that I am being bugged with.
I have 2 CPP files, 1 header file. The .H file defines functions and have a couple of lines that that defines a couple of global variables:
LPDIRECT3D8 g_pD3D = 0;
LPDIRECT3DDEVICE8 g_pDevice = 0;
D3DPRESENT_PARAMETERS g_SavedPresParams;
LPDIRECT3DSURFACE8 g_pBackSurface;
int g_DeviceHeight;
int g_DeviceWidth;
CCamera g_Camera;
The 2 CPP files (one is engine.cpp and the other is core.cpp) both included the header file above. I have put
#ifndef CLASSDEFINE_H
#define CLASSDEFINE_H
.
.
LPDIRECT3D8 g_pD3D = 0;
LPDIRECT3DDEVICE8 g_pDevice = 0;
D3DPRESENT_PARAMETERS g_SavedPresParams;
LPDIRECT3DSURFACE8 g_pBackSurface;
int g_DeviceHeight;
int g_DeviceWidth;
CCamera g_Camera;
#endif
But i still end up with the folowing complie error:
quote:
inking...
engine.obj : error LNK2005: "struct IDirect3DDevice8 * g_pDevice" (?g_pDevice@@3PAUIDirect3DDevice8@@A) already defined in core.obj
engine.obj : error LNK2005: "struct IDirect3D8 * g_pD3D" (?g_pD3D@@3PAUIDirect3D8@@A) already defined in core.obj
engine.obj : error LNK2005: "struct IDirect3DSurface8 * g_pBackSurface" (?g_pBackSurface@@3PAUIDirect3DSurface8@@A) already defined in core.obj
engine.obj : error LNK2005: "struct _D3DPRESENT_PARAMETERS_ g_SavedPresParams" (?g_SavedPresParams@@3U_D3DPRESENT_PARAMETERS_@@A) already defined in core.obj
engine.obj : error LNK2005: "int g_DeviceHeight" (?g_DeviceHeight@@3HA) already defined in core.obj
engine.obj : error LNK2005: "class CCamera g_Camera" (?g_Camera@@3VCCamera@@A) already defined in core.obj
engine.obj : error LNK2005: "int g_DeviceWidth" (?g_DeviceWidth@@3HA) already defined in core.obj
Debug/Direct3D_GameEngine.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
Direct3D_GameEngine.exe - 8 error(s), 0 warning(s)
So what did I do wrong?
Edited by - LonelyTower on January 30, 2002 9:47:59 AM
"Magic makes the world go round." - Erasmus, Quest For Glory I