I am really not understanding this.
Basically, I am trying to make, as a library, some classes to aid in handling some DirectX stuff so that I don't have to do it in other games. GameBase is a class I made. This dll project compiles as a dll and it compiles without issue.
I have another project that references this one, and I made a class called BlankGame, which extends GameBase. Whenever I build this executable project, I get the following linker errors.
error LNK2019: unresolved external symbol "public: virtual __thiscall GameBase::~GameBase(void)" (??1GameBase@@UAE@XZ) referenced in function "public: virtual __thiscall BlankGame::~BlankGame(void)" (??1BlankGame@@UAE@XZ)
error LNK2001: unresolved external symbol "public: virtual void __thiscall GameBase::UnloadContent(void)" (?UnloadContent@GameBase@@UAEXXZ)
error LNK2001: unresolved external symbol "public: virtual bool __thiscall GameBase::LoadContent(void)" (?LoadContent@GameBase@@UAE_NXZ)
I defined GameBase.h, BlankGame.cpp and BlankGame.h below.
Gamebase.h
#include "stdafx.h"
#pragma once
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "d3dx11.lib")
#pragma comment(lib, "d3dx10.lib")
DLEX class GameBase
{
public:
virtual ~GameBase() = 0;
virtual bool LoadContent();
virtual void UnloadContent();
bool Initialize(HINSTANCE hInst, HWND winHandle, struct DXInitOptions options);
void ShutDown();
void BeginScene(float red, float green, float blue, float alpha);
void EndScene();
virtual void Render() = 0;
virtual void Update() = 0;
void GetProjectionMatrix(D3DXMATRIX&);
void GetWorldMatrix(D3DXMATRIX&);
void GetOrthoMatrix(D3DXMATRIX&);
void GetVideoCardInfo(char*, int&);
bool CompileD3DShader(wchar_t* filePath, char* entry, char* shaderModel, ID3DBlob** buffer);
protected:
ID3D11Device* dev;
ID3D11DeviceContext* devContext;
IDXGISwapChain* swapChain;
ID3D11RenderTargetView* backBufferTarget;
ID3D11Texture2D* depthStencilBuffer;
ID3D11DepthStencilState* depthStencilState;
ID3D11DepthStencilView* depthStencilView;
ID3D11RasterizerState* rasterState;
D3DXMATRIX projectionMatrix;
D3DXMATRIX worldMatrix;
D3DXMATRIX orthoMatrix;
bool vsyncEnabled;
int vidMemory;
char vidCardDesc[128];
};
BlankGame.h
#pragma once
#include <D3D11.h>
#include <D3Dx11.h>
#include <D3Dx10.h>
#include <D3Dcompiler.h>
#include <DxErr.h>
#include <xnamath.h>
#include <GameBase.h>
class BlankGame : public GameBase
{
public:
BlankGame();
~BlankGame();
bool LoadContent();
void UnloadContent();
};
BlankGame.cpp
#include "BlankGame.h"
BlankGame::BlankGame()
{
}
BlankGame::~BlankGame()
{
}
bool BlankGame::LoadContent()
{
return true;
}
void BlankGame::UnloadContent()
{
}
What am I doing wrong? The way I made GameBase works in other projects I made as I followed DirectX tutorials, the only difference being GameBase would be in the same project as the subclass extending it, instead of in a separate library.