Can't Dynamic link with libraries
-
Hi,
i have recently switched to VS2010 for building my project. Until now (with mingw) i have always build the dll and successfully linked with the exe program. But now with VS2010 compilers i can't do that, but each time i get the LNK2019 error. I've tried to build the library with the static option in the configure variable of the Qt project, and this time it worked.So my question is why i can't build a dll and link with exe anymore?
As IDE I use Qt creator and jom as make tool.
-
Hi,
What are the exact errors your are getting ?
-
This are the error:
@mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl Assimp::Importer::~Importer(void)" (??1Importer@Assimp@@QEAA@XZ) referenced in function "public: virtual __cdecl MainWindow::~MainWindow(void)" (??1MainWindow@@UEAA@XZ)mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl Assimp::Importer::Importer(void)" (??0Importer@Assimp@@QEAA@XZ) referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: char const * __cdecl Assimp::Importer::GetErrorString(void)const " (?GetErrorString@Importer@Assimp@@QEBAPEBDXZ) referenced in function "private: void __cdecl MainWindow::importFile(void)" (?importFile@MainWindow@@AEAAXXZ).
@
and other similar to this( basically for every function related to Assim::Importer).However i found this in the lib documentation(i don't know if this can be helpful):
Windows DLL Build
assimp can be built as DLL. You just need to select a -dll config from the list of project configs and you're fine.
NOTE: Theoretically, assimp-dll can be used with multithreaded (non-dll) runtime libraries, as long as you don't utilize any non-public stuff from the code folder. However, if you happen to encounter very strange problems, try changing the runtime to Multithreaded (Debug) DLL.
Thanks for the help.
-
If you want look at source file i have made a repo on sourceforge(cause i need help on it) https://sourceforge.net/p/threedmate/code/ci/default/tree/
they are located in the src directory. -
Sorry, didn't had time to setup VS, just tried to build it with OS X but it chokes on STEPFile
-
Ok thanks anyway! As i said i use Qt creator i don't know how to set it up in other IDE.
-
OK maybe i found the problem: it seems that you have to manually declare wich symbol to export in the def file or in the header with "__declspec( dllexport )"
-
Indeed, that's true especially for visual studio. You can have a look "here":http://stackoverflow.com/questions/8863193/what-does-declspecdllimport-really-mean for a basic explanation