Update: Static compilation with a static Microsoft VC++ library is now working with the final releases of Qt 4.6 and Qt Creator 1.3. The compiled size using Microsoft's compiler is much smaller (see http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler ). Note that in addition to configuring Qt Creator to recognize the static MSVC build of Qt, you must also add build settings in the "Projects" menu.
--Charles Burns On Tue, Nov 24, 2009 at 2:22 PM, Tiago Correia <[email protected]> wrote: > 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 <[email protected] > > 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@@q...@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 >> [email protected] >> 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 > > > _______________________________________________ > Qt-creator mailing list > [email protected] > http://lists.trolltech.com/mailman/listinfo/qt-creator > > -- "Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind." --Dr. Seuss
_______________________________________________ Qt-creator mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-creator
