I am working on making a game engine. The engine is dll project. Right now the engine builds to a dll and lib. I am trying to test what I have so far with with another project. This is the error messages that I get:
error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Aria::GameConfig::GameConfig(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (__imp_??0GameConfig@Aria@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z) referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@YAHXZ) D:\My Documents\Programing\Repo\NDTD\NDTD\Project\Main.obj
error LNK2019: unresolved external symbol "public: __thiscall TestGame::TestGame(class Aria::GameConfig *)" (??0TestGame@@QAE@PAVGameConfig@Aria@@@Z) referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@YAHXZ) D:\My Documents\Programing\Repo\NDTD\NDTD\Project\Main.obj
error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup D:\My Documents\Programing\Repo\NDTD\NDTD\Project\MSVCRTD.lib(crtexe.obj)
Here part of my platform.h file that has the dll import and export macros
#if !defined(ARIA_STATIC)
#ifdef ARIA_SYS_WINDOWS
#if defined (ARIA_NONCLIENT_BUILD)
// define dllexport and dllimport macros
#ifndef ARIA_API
#define ARIA_API __declspec(dllexport)
#endif
#else
#ifndef ARIA_API
#define ARIA_API __declspec(dllimport)
#endif
#endif
// Visual c++ compiler warning C4251 disable
#ifdef _MSC_VER
#pragma warning(disable : 4251)
#endif
#else // Linux and MAC OS X
#if __GNUC__ >= 4
// GCC 4 has unique keywords for showing/hiding symbols
// the same keyword is used for both import and export
#define ARIA_API __attribute__ ((__visibility__("default")))
#define ARIA_API __attribute__ ((__visibility__("default")))
#else
#define ARIA_API
#define ARIA_API
#endif
#endif
#else
// static build doesn't need import/export macros
#define ARIA_API
#define ARIA_API
#endif
In I have built the engine with the preprocessor definition ARIA_NONCLIENT_BUILD
and UNICODE
and windows it defined. I have linked to SDL lib and included the header files. I am also using unicode strings with wchar. I also have not forgotten to add the ARIA_API macro in class definitions.
In the test project here is the main.cpp file
#include <Game\Game.h>
using namespace Aria;
class TestGame : public IGame
{
public:
TestGame(GameConfig* config);
~TestGame();
void OnStartUp() override;
void OnUpdate(float dt) override;
void OnRender(float dt) override;
void OnShutdown() override;
};
void TestGame::OnStartUp()
{
}
void TestGame::OnUpdate(float dt)
{
}
void TestGame::OnRender(float dt)
{
}
void TestGame::OnShutdown()
{
}
int main()
{
GameConfig* config = new GameConfig(ATEXT("test.config"));
TestGame* game = new TestGame(config);
return game->Run();
}
If I have forgot something then let me know.