Dll/So: build with static linking
-
wrote on 26 Aug 2020, 13:58 last edited by
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! -
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!wrote on 26 Aug 2020, 14:02 last edited by@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
). -
@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
).wrote on 26 Aug 2020, 14:14 last edited by@JohanSolo I need to create a dll without external qt dependencies. Dll loads and got a functions by names (already known) in the runtime of the host application. The host app also built with static linking.
I need this variant. -
wrote on 26 Aug 2020, 15:05 last edited by JohanSolo
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? -
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?wrote on 26 Aug 2020, 16:04 last edited by@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!
-
wrote on 26 Aug 2020, 17:52 last edited by
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. -
wrote on 16 May 2022, 07:00 last edited by
to select cmake instead of qmake as buildsystem, can output dll with qt msvc static.
-
wrote on 16 May 2022, 10:54 last edited by
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.