[Qt-interest] Link errors with static Qt

Juan D Guzman lostinthecode at googlemail.com
Tue Mar 31 09:05:38 CEST 2009


Urs Dönni wrote:
> Hi,
>
> I'm using VisualStudio 2005 and Qt 4.5. I have a problem when using 
> the static version of Qt. The project compiles, links and runs fine 
> when using the shared version of Qt (linking QtOpenGL4.lib, QtGui4.lib 
> and QtCore4.lib).
>
> Then I wanted to use static Qt, so I compiled Qt using
> > configure -static
> > nmake
>
> I link QtOpenGL.lib, QtGui.lib and QtCore.lib, and I get several link 
> errors (see below). As far as I can tell, all the function that could 
> not be linked should be in the libs I link against (and when I don't 
> link against one of those, I get hundreds of link errors). Does 
> anybody have an idea why those functions are not found and what I can 
> do about it?
>
> Here's the full list of libs I link against: opengl32.lib, glu32.lib, 
> gdi32.lib, user32.lib, zdll.lib, imm32.lib, winmm.lib, ws2_32.lib, 
> kernel32.lib, winspool.lib, comdlg32.lib, advapi32.lib, shell32.lib, 
> ole32.lib, oleaut32.lib, uuid.lib, odbc32.lib, odbccp32.lib, 
> $(QT)\lib\QtCore.lib, $(QT)\lib\QtGui.lib, $(QT)\lib\QtOpenGL.lib. Let 
> me know if you need any more information.
>
> Any help is appreciated!
>
> Urs
>
> Error messages:
>
> marchingsource.obj : error LNK2001: unresolved external symbol 
> "__declspec(dllimport) public: static class QString __cdecl 
> QFileDialog::getSaveFileName(class QWidget *,class QString const 
> &,class QString const &,class QString const &,class QString *,class 
> QFlags<enum QFileDialog::Option>)" 
> (__imp_?getSaveFileName at QFileDialog@@SA?AVQString@@PAVQWidget@@ABV2 at 11PAV2@V?$QFlags at W4Option@QFileDialog@@@@@Z)
> file_dialog_parameters.obj : error LNK2001: unresolved external symbol 
> "__declspec(dllimport) public: class QString & __thiscall 
> QString::operator=(char const *)" (__imp_??4QString@@QAEAAV0 at PBD@Z)
> glwidget.obj : error LNK2001: unresolved external symbol 
> "__declspec(dllimport) public: static void __cdecl 
> QToolTip::hideText(void)" (__imp_?hideText at QToolTip@@SAXXZ)
> main_widget.obj : error LNK2001: unresolved external symbol 
> "__declspec(dllimport) public: class QString & __thiscall 
> QString::append(char const *)" (__imp_?append at QString@@QAEAAV1 at PBD@Z)
> main_widget.obj : error LNK2001: unresolved external symbol 
> "__declspec(dllimport) public: static class QColor __cdecl 
> QColorDialog::getColor(class QColor const &,class QWidget *)" 
> (__imp_?getColor at QColorDialog@@SA?AVQColor@@ABV2 at PAVQWidget@@@Z)
> main_widget.obj : error LNK2001: unresolved external symbol 
> "__declspec(dllimport) public: static class QString __cdecl 
> QFileDialog::getOpenFileName(class QWidget *,class QString const 
> &,class QString const &,class QString const &,class QString *,class 
> QFlags<enum QFileDialog::Option>)" 
> (__imp_?getOpenFileName at QFileDialog@@SA?AVQString@@PAVQWidget@@ABV2 at 11PAV2@V?$QFlags at W4Option@QFileDialog@@@@@Z)
> Release/Quiqshape.exe : fatal error LNK1120: 6 unresolved externals
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   
have you built static versions of the libraries?

regards

jd



More information about the Qt-interest-old mailing list