Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Can't Dynamic link with libraries
Qt 6.11 is out! See what's new in the release blog

Can't Dynamic link with libraries

Scheduled Pinned Locked Moved C++ Gurus
8 Posts 2 Posters 5.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ceora
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What are the exact errors your are getting ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ceora
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ceora
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Sorry, didn't had time to setup VS, just tried to build it with OS X but it chokes on STEPFile

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • C Offline
              C Offline
              ceora
              wrote on last edited by
              #6

              Ok thanks anyway! As i said i use Qt creator i don't know how to set it up in other IDE.

              1 Reply Last reply
              0
              • C Offline
                C Offline
                ceora
                wrote on last edited by
                #7

                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 )"

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  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

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved