PDA

View Full Version : shared vs static



alisami
3rd October 2008, 15:24
hi,

i have been trying to build qt in windows as a static library.

until now i have been using it as a shared library and the following worked fine with shared library mode. also i have been able to build the same in linux using static qt libraries but i have this problem on windows.

do you have any comments about the following problem ?

the flags i've used with configure is as follows:


configure -debug -static -no-fast -no-accessibility -no-dsp -no-vcproj -qt-zlib -qt-gif -qt-libpng -qt-libtiff -qt-libjpeg -no-libmng -no-qt3support -no-phonon -no-webkit -no-assistant-webkit


i have a library with the following pro file:


TEMPLATE = lib
TARGET =
INCLUDEPATH += .
RESOURCES += AKKB.qrc
HEADERS = all the header files goes here
SOURCES = all the source files goes here
CONFIG += debug qt static


i link the resulting library in another application and also i link the libraries
- qtmaind.lib
- qtcored.lib
- qtguid.lib

when i compile the application i receive the following errors:



qtcored.lib(qtextcodec.obj) : error LNK2019: unresolved external symbol __imp__CharNextExA@12 referenced in function "public: class QString __thiscall QWindowsLocalCodec::convertToUnicodeCharByChar(cha r const *,int,struct QTextCodec::ConverterState *)const " (?convertToUnicodeCharByChar@QWindowsLocalCodec@@Q BE?AVQString@@PBDHPAUConverterState@QTextCodec@@@Z )
qtcored.lib(qeventdispatcher_win.obj) : error LNK2019: unresolved external symbol __imp__UnregisterClassA@8 referenced in function "public: virtual __thiscall QEventDispatcherWin32Private::~QEventDispatcherWin 32Private(void)" (??1QEventDispatcherWin32Private@@UAE@XZ)
qtguid.lib(qapplication_win.obj) : error LNK2001: unresolved external symbol __imp__UnregisterClassA@8

...

qtguid.lib(qpixmap_win.obj) : error LNK2019: unresolved external symbol __imp__GetDIBits@28 referenced in function "public: static class QPixmap __cdecl QPixmap::fromWinHBITMAP(struct HBITMAP__ *,enum QPixmap::HBitmapFormat)" (?fromWinHBITMAP@QPixmap@@SA?AV1@PAUHBITMAP__@@W4H BitmapFormat@1@@Z)
qtguid.lib(qpixmap_win.obj) : error LNK2019: unresolved external symbol __imp__DrawIconEx@36 referenced in function "class QPixmap __cdecl convertHIconToPixmap(struct HICON__ * const)" (?convertHIconToPixmap@@YA?AVQPixmap@@QAUHICON__@@ @Z)
qtguid.lib(qpixmap_win.obj) : error LNK2019: unresolved external symbol __imp__GetIconInfo@8 referenced in function "class QPixmap __cdecl convertHIconToPixmap(struct HICON__ * const)" (?convertHIconToPixmap@@YA?AVQPixmap@@QAUHICON__@@ @Z)
qtguid.lib(qpixmap_win.obj) : error LNK2019: unresolved external symbol __imp__LoadImageW@24 referenced in function "class QPixmap __cdecl loadIconFromShell32(int,int)" (?loadIconFromShell32@@YA?AVQPixmap@@HH@Z)
qtguid.lib(qdnd_win.obj) : error LNK2019: unresolved external symbol __imp__RegisterClipboardFormatW@4 referenced in function "public: __thiscall QOleDataObject::QOleDataObject(class QMimeData *)" (??0QOleDataObject@@QAE@PAVQMimeData@@@Z)

...

qtguid.lib(qpaintengine_raster.obj) : error LNK2019: unresolved external symbol __imp__Rectangle@20 referenced in function "private: bool __thiscall QRasterPaintEngine::drawTextInFontBuffer(class QRect const &,int,int,int,int,class QTextItem const &,bool,double,class QPointF const &)" (?drawTextInFontBuffer@QRasterPaintEngine@@AAE_NAB VQRect@@HHHHABVQTextItem@@_NNABVQPointF@@@Z)
qtguid.lib(qpaintengine_raster.obj) : error LNK2019: unresolved external symbol __imp__GdiFlush@0 referenced in function "public: void __thiscall QRasterBuffer::prepareBuffer(int,int)" (?prepareBuffer@QRasterBuffer@@QAEXHH@Z)
qtguid.lib(qwindowsxpstyle.obj) : error LNK2001: unresolved external symbol __imp__GdiFlush@0
qtguid.lib(qpaintengine_raster.obj) : error LNK2019: unresolved external symbol __imp__ExtTextOutW@32 referenced in function "void __cdecl draw_text_item_win(class QPointF const &,class QTextItemInt const &,struct HDC__ *,bool,class QTransform const &,class QPointF const &)" (?draw_text_item_win@@YAXABVQPointF@@ABVQTextItemI nt@@PAUHDC__@@_NABVQTransform@@0@Z)
qtguid.lib(qpaintengine_raster.obj) : error LNK2019: unresolved external symbol __imp__SetWorldTransform@8 referenced in function "void __cdecl draw_text_item_win(class QPointF const &,class QTextItemInt const &,struct HDC__ *,bool,class QTransform const &,class QPointF const &)" (?draw_text_item_win@@YAXABVQPointF@@ABVQTextItemI nt@@PAUHDC__@@_NABVQTransform@@0@Z)
qtguid.lib(qpaintengine_raster.obj) : error LNK2019: unresolved external symbol __imp__SetGraphicsMode@8 referenced in function "void __cdecl draw_text_item_win(class QPointF const &,class QTextItemInt const &,struct HDC__ *,bool,class QTransform const &,class QPointF const &)" (?draw_text_item_win@@YAXABVQPointF@@ABVQTextItemI nt@@PAUHDC__@@_NABVQTransform@@0@Z)
qtguid.lib(qpaintengine_raster.obj) : error LNK2019: unresolved external symbol __imp__TextOutA@20 referenced in function "void __cdecl draw_text_item_win(class QPointF const &,class QTextItemInt const &,struct HDC__ *,bool,class QTransform const &,class QPointF const &)" (?draw_text_item_win@@YAXABVQPointF@@ABVQTextItemI nt@@PAUHDC__@@_NABVQTransform@@0@Z)
qtguid.lib(qpaintengine_raster.obj) : error LNK2019: unresolved external symbol __imp__TextOutW@20 referenced in function "void __cdecl draw_text_item_win(class QPointF const &,class QTextItemInt const &,struct HDC__ *,bool,class QTransform const &,class QPointF const &)" (?draw_text_item_win@@YAXABVQPointF@@ABVQTextItemI nt@@PAUHDC__@@_NABVQTransform@@0@Z)
qtguid.lib(qpaintengine_raster.obj) : error LNK2019: unresolved external symbol __imp__SetBkMode@8 referenced in function "void __cdecl draw_text_item_win(class QPointF const &,class QTextItemInt const &,struct HDC__ *,bool,class QTransform const &,class QPointF const &)" (?draw_text_item_win@@YAXABVQPointF@@ABVQTextItemI nt@@PAUHDC__@@_NABVQTransform@@0@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2001: unresolved external symbol __imp__SetBkMode@8
qtguid.lib(qpaintengine_raster.obj) : error LNK2019: unresolved external symbol __imp__SetTextAlign@8 referenced in function "void __cdecl draw_text_item_win(class QPointF const &,class QTextItemInt const &,struct HDC__ *,bool,class QTransform const &,class QPointF const &)" (?draw_text_item_win@@YAXABVQPointF@@ABVQTextItemI nt@@PAUHDC__@@_NABVQTransform@@0@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2001: unresolved external symbol __imp__SetTextAlign@8
qtguid.lib(qfontdatabase.obj) : error LNK2019: unresolved external symbol __imp__GetTextMetricsW@8 referenced in function "void __cdecl populate_database(class QString const &)" (?populate_database@@YAXABVQString@@@Z)

...

qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__SetPolyFillMode@8 referenced in function "public: void __thiscall QWin32PrintEnginePrivate::composeGdiPath(class QPainterPath const &)" (?composeGdiPath@QWin32PrintEnginePrivate@@QAEXABV QPainterPath@@@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__EndPath@4 referenced in function "public: void __thiscall QWin32PrintEnginePrivate::composeGdiPath(class QPainterPath const &)" (?composeGdiPath@QWin32PrintEnginePrivate@@QAEXABV QPainterPath@@@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__PolyBezierTo@12 referenced in function "public: void __thiscall QWin32PrintEnginePrivate::composeGdiPath(class QPainterPath const &)" (?composeGdiPath@QWin32PrintEnginePrivate@@QAEXABV QPainterPath@@@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__LineTo@12 referenced in function "public: void __thiscall QWin32PrintEnginePrivate::composeGdiPath(class QPainterPath const &)" (?composeGdiPath@QWin32PrintEnginePrivate@@QAEXABV QPainterPath@@@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__MoveToEx@16 referenced in function "public: void __thiscall QWin32PrintEnginePrivate::composeGdiPath(class QPainterPath const &)" (?composeGdiPath@QWin32PrintEnginePrivate@@QAEXABV QPainterPath@@@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__CloseFigure@4 referenced in function "public: void __thiscall QWin32PrintEnginePrivate::composeGdiPath(class QPainterPath const &)" (?composeGdiPath@QWin32PrintEnginePrivate@@QAEXABV QPainterPath@@@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__BeginPath@4 referenced in function "public: void __thiscall QWin32PrintEnginePrivate::composeGdiPath(class QPainterPath const &)" (?composeGdiPath@QWin32PrintEnginePrivate@@QAEXABV QPainterPath@@@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__FillPath@4 referenced in function "public: void __thiscall QWin32PrintEnginePrivate::fillPath_dev(class QPainterPath const &,class QColor const &)" (?fillPath_dev@QWin32PrintEnginePrivate@@QAEXABVQP ainterPath@@ABVQColor@@@Z)
qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__StrokePath@4 referenced in function "public: void __thiscall QWin32PrintEnginePrivate::strokePath_dev(class QPainterPath const &,class QColor const &,double)" (?strokePath_dev@QWin32PrintEnginePrivate@@QAEXABV QPainterPath@@ABVQColor@@N@Z)

...

qtguid.lib(qprinterinfo_win.obj) : error LNK2001: unresolved external symbol __imp__DeviceCapabilitiesA@20
qtguid.lib(qprintengine_win.obj) : error LNK2019: unresolved external symbol __imp__DeviceCapabilitiesW@20 referenced in function "public: class QList<class QVariant> __thiscall QWin32PrintEnginePrivate::queryResolutions(void)co nst " (?queryResolutions@QWin32PrintEnginePrivate@@QBE?A V?$QList@VQVariant@@@@XZ)
qtguid.lib(qprinterinfo_win.obj) : error LNK2001: unresolved external symbol __imp__DeviceCapabilitiesW@20

...

and so on...

jpn
3rd October 2008, 18:03
Static debug libs? Why on the earth? :)

alisami
3rd October 2008, 18:24
actually the executable will not be run on windows. but we are doing simulation on windows, and I don't want to add some flags for switching between static and shared mode.

alisami
4th October 2008, 13:04
i figured out that when using static qt libraries, it is required to link the following msvc libraries as well to the application:


gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib winspool.lib ws2_32.lib ole32.lib user32.lib advapi32.lib msimg32.lib shell32.lib kernel32.lib uuid.lib