chao.zhang Posted September 24, 2012 Share Posted September 24, 2012 Hello all, I need to expand some new functions and classes in unigine engine dll and call them in applications. when i test this i always got link2019 errors. So Should anybody know how to do this please help. for example In unigine engine project, I add a new class with the .h and .cpp file as follows(for test only): globe.h #ifndef __GLOBE_H__ #define __GLOBE_H__ /* */ #ifdef GLOBE_DLL #define GLOBE_API __declspec(dllexport) #else #define GLOBE_API __declspec(dllimport) #endif class GLOBE_API Globe { public: Globe(); ~Globe(); }; globe.cpp #ifndef GLOBE_DLL #define GLOBE_DLL #endif #include "Globe.h" Globe::Globe() { } Globe::~Globe() { } then I create a new Globe instance in application which link the engine dll int main(int argc,char **argv) { Engine *engine = Engine::init(UNIGINE_VERSION,argc,argv); Globe *globe = new Globe(); engine->main(); Engine::shutdown(); return 0; } it complains: error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Globe::Globe(void)" (__imp_??0Globe@@QAE@XZ), Link to comment
unclebob Posted September 24, 2012 Share Posted September 24, 2012 Hi Chao, You probably forgot to add yourdll.lib file to main project. Link to comment
chao.zhang Posted September 25, 2012 Author Share Posted September 25, 2012 hello, unclebob. i have defined the new class in Unigine engine dll project and want to export in the Unigine engine dll , while the native engine functions are OK, my new defined is not. Link to comment
chao.zhang Posted September 25, 2012 Author Share Posted September 25, 2012 sorry, it is solved, Its my default that I use the old dll and import library. Thanks everybody again. Link to comment
Recommended Posts