[Qt-creator] Static build with Microsoft compiler
Tiago Correia
tiago at cnotinfor.pt
Tue Nov 24 22:22:05 CET 2009
Hi,
I'm very interested in this thread, since we are now thinking in moving from
Visual Studio to Qt Creator.
Any comments on this?
On Sun, Nov 22, 2009 at 11:06 PM, Charles N Burns
<charlesnburns at gmail.com>wrote:
> Hello all,
>
> I am trying to use Qt Creator 1.3 RC to make a static build of an
> application using the Microsoft compiler (from Visual Studio Prof.
> 2008).
>
> I am familiar with building Qt static (and have even written some
> articles on how to do so), but when I try to build my application in
> Qt Creator, it builds with dynamic linking, even when I specify a
> statically compiled version of Qt. I wasn't aware this was even
> possible.
>
> I know the resulting executable is dynamic because it is very small
> and, when I run it directly, it complains about missing qtcore.dll.
>
> ---------------------- .pro file --------------------------
>
> TARGET = ImageGuide
> TEMPLATE = app
> SOURCES += main.cpp Window.cpp mediancut.cpp
> HEADERS += Window.h mediancut.h ScrollArea.h
> CONFIG += static staticlibs stl
> static {
> QTPLUGIN += qjpeg qgif qtiff
> DEFINES += STATIC
> }
>
> ---------------------- from main.cpp file --------------------------
>
> In my main.cpp:
> #ifdef STATIC
> #include <QtPlugin>
> Q_IMPORT_PLUGIN(qjpeg)
> Q_IMPORT_PLUGIN(qgif)
> Q_IMPORT_PLUGIN(qtiff)
> #endif
>
> -------------------------- --------------------------
> The linker errors I get start with:
>
> C:/qtprojects/ImageGuideMC/main.obj:-1: error: unresolved external
> symbol "class QObject * __cdecl qt_plugin_instance_qjpeg(void)"
> (?qt_plugin_instance_qjpeg@@YAPAVQObject@@XZ) referenced in function
> "public: __thiscall
> StaticqjpegPluginInstance::StaticqjpegPluginInstance(void)"
> (??0StaticqjpegPluginInstance@@QAE at XZ)
>
> When I remove the Q_IMPORT_PLUGIN statements, my project compiles just
> fine, but it is NOT statically linked.
>
> How can I build a statically linked program using the MS compiler?
>
> Best regards,
>
> --Charles Burns
> http://www.formortals.com/author/charles
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator
>
--
Tiago Correia
chief technology officer
cnoti inovação & desenvolvimento – Aprendizagem enRiquecida pela Tecnologia
www.cnotinfor.pt
Telefone: +351 239 499 231
Subscreva gratuitamente a nossa Newsletter BICA – Boletim informativo de
Interactividade, Comunicação e Aprendizagem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20091124/40dde57c/attachment.html
More information about the Qt-creator-old
mailing list