So I have this dll that holds some functions for my program. Called gc.dll I have it as a reference in my main project. In my main project I have 2 headers and 2 source files,
dx9d3d.h
main.h
main.cpp
dx9d3d.h
Heres my includes on each file
dx9d3d.h:
#include "gc.h"
dx9d3d.cpp:
#include "dx9d3d.h"
main.h:
#include <Windows.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include "basics.h"
#include "dx9d3d.h"
main.cpp:
#include "main.h"
I keep getting the linker error for multi defined symbols for the d3ddevice and directx symbols I have in my gc.h. I have no idea how I can include gc.h to dx9d3d.h without it being a multi defined symbol :/ please help im kindof a noob to these linker errors.
and heres the code inside gc.h
namespace xaD3D {
__declspec(dllexport) LPDIRECT3D9 d3d;
__declspec(dllexport) LPDIRECT3DDEVICE9 d3dDev;
__declspec(dllexport) bool initD3D(HWND hWnd);
}
and heres the errors
2>main.obj : error LNK2005: "struct IDirect3DDevice9 * xaD3D::d3dDev" (? d3dDev@xaD3D@@3PAUIDirect3DDevice9@@A) already defined in dx9d3d.obj
2>main.obj : error LNK2005: "struct IDirect3D9 * xaD3D::d3d" (? d3d@xaD3D@@3PAUIDirect3D9@@A) already defined in dx9d3d.obj