PDA

View Full Version : Using shared for debugging and static for deployment



bnilsson
25th July 2009, 10:20
I am using Qt 4.5.1, WinXP and Visual Studio 2008.

As far as I understand, the best way of working is to use Qt shared libraries while debugging and development, and linking statically for deployment.

Questions:
1)
Does this require two separate Qt installations, or can Qt shared debug and Qt static release co-exist in the same Qt directory? If they can co-exist in the same Qt directory, what preparations are necessary (such as nmake distclean or nmake clean etc.) before the second installation?

2)
Is it possible to have a .vcproj project where the debug configuration is using shared libraries and the release configuration is using static link? if the answer is yes, how should this be done?

wysota
25th July 2009, 12:24
1)
Does this require two separate Qt installations, or can Qt shared debug and Qt static release co-exist in the same Qt directory?
They should be in different directories.


If they can co-exist in the same Qt directory, what preparations are necessary (such as nmake distclean or nmake clean etc.) before the second installation?
You'd have to compile one of them with some library prefix or suffix so that library names do not clash (i.e. have "QtCore" and "QtCore_static" libraries) and adjust specs accordingly.


2)
Is it possible to have a .vcproj project where the debug configuration is using shared libraries and the release configuration is using static link? if the answer is yes, how should this be done?

Sure.
CONFIG(debug, debug|release) {
LIBS += -lsomelib
}
CONFIG(release, debug|release){
CONFIG += static
# static build may require changing some of the compiler flags, i.e. for MSVC
...
LIBS += somelib.a
# etc.
}