Dll/So: build with static linking
-
Hi!
Trying to build C++ Library (dll) with static linking (msvc 32 bit static) via using Qt Creator. But no any dll in the output directory. With dynamic linking - there is no problem. If build via Visual Studio with static linking - there is no problem as well. Pro file created by default with the C++ Library project type.
Is it possible to fix this via using Qt Creator??
Thank you! -
@sitesv said in Dll/So: build with static linking:
Hi!
Trying to build C++ Library (dll) with static linking (msvc 32 bit static) via using Qt Creator. But no any dll in the output directory.There's no point in looking for a
.dll
when you're building a static library... Static libs on windows are.lib
(not to be confused with import libs, which also are.lib
). -
A
.dll
is not a static lib. You should look at the docs to see how to create a static library.I'm not sure whether your problem is that you didn't find the way to build a static lib, of if you're trying to find a
.dll
file after building a static library...Edit: or is it you want to produce a
.dll
linked statically to Qt? -
@JohanSolo said in Dll/So: build with static linking:
Edit: or is it you want to produce a .dll linked statically to Qt?
Yes! It is!
-
OK, then you need a static build of Qt. I guess you followed this. Once you've successfully built your static Qt libs, it's just a matter of linking your library against the various libQtXXX.a. AFAIK (I've never done this myself), there are caveats, for instance you have to use the very same compiler (i.e. exact same version) to compile your library as for the static Qt build.
@sitesv said in Dll/So: build with static linking:
Trying to build C++ Library (dll) with static linking (msvc 32 bit static) via using Qt Creator. But no any dll in the output directory.
Obviously something is going wrong. What does your compiler output tell you? If nothing is produced, I double there are no error messages that could explain this build failure. Please post
.pro
file and compiler output, so that people here can help. I'm afraid my crystal ball is broken. -
https://doc.qt.io/qt-5/qmake-common-projects.html#building-a-library
if you select qmake build dll with static qt, you can add "dll" to "CONFIG" varible in .pro file.