Important: Please read the Qt Code of Conduct -

Statically-built Qt4.8.4 cannot build DLL for a Shared Library

  • Greetings!

    I built Qt 4.8.4 statically with msvc...

    Here are the commands I used in building:
    @configure -static -debug-and-release
    nmake sub-src@

    Successfully built it. and it works.

    I got the only problem when building a Shared Library that I wrote. AFAIK, building shared libs supposedly output dll files.
    This "link": explains the difference between static and shared libraries.

    Although my applications work when linking them to my library but getting LNK4217 warnings.

    should i build another Qt in -shared configuration (since -shared-and-static is mac osx specific)

    What i want to get from it is that I have a static MyApp.exe linked to MyLib.dll and these 2 files are present when I deploy my application. (MyApp.exe will not work without MyLib.dll)

    Thanks and more powers!

  • Hi,

    I dont know whether this will be of any help, there are few tutorials on "How to Create a DLL": , "How to use a DLL": and "Static Libary": . You can take a look at these tutorials that explains the basics of creating a static library.


  • OK, I found out that statically built Qt cannot produce dll files which can only be produced with "shared Qt". Though you can link a "statically-built" app with a "shared-built" dll/library file, you may end up adding the QtGui, QtCore, etc DLLS since it is needed by your generated library.

    Thanks for the link though. One of these days I will try to read those. Cheers and more powers!

    PS. I will not YET mark this thread as [solved]. I am waiting for other devs to post if they found solution to this problem.

Log in to reply