Results 1 to 4 of 4

Thread: shared vs static

  1. #1
    Join Date
    May 2008
    Posts
    61
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default shared vs static

    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:
    Qt Code:
    1. 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
    To copy to clipboard, switch view to plain text mode 

    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:repareBuffer(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...

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: shared vs static

    Static debug libs? Why on the earth?
    J-P Nurmi

  3. #3
    Join Date
    May 2008
    Posts
    61
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: shared vs static

    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.

  4. #4
    Join Date
    May 2008
    Posts
    61
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: shared vs static

    i figured out that when using static qt libraries, it is required to link the following msvc libraries as well to the application:

    Qt Code:
    1. 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
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 16
    Last Post: 23rd May 2008, 10:12
  2. Please Help-->have few doubts with Static build in Windows !
    By Krish in forum Installation and Deployment
    Replies: 1
    Last Post: 17th March 2008, 14:37
  3. STATIC vs. SHARED
    By KaptainKarl in forum Installation and Deployment
    Replies: 1
    Last Post: 27th August 2007, 16:31
  4. Replies: 5
    Last Post: 18th April 2007, 20:02
  5. shared versus static build
    By jcr in forum Installation and Deployment
    Replies: 2
    Last Post: 28th January 2006, 08:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.