Results 1 to 1 of 1

Thread: Static build + examples + Qt project integration

  1. #1
    Join Date
    Apr 2012
    Posts
    38
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Static build + examples + Qt project integration

    Hello everyone and hello Uwe,

    Win7x64 + Qt4.5.1 + Qwt6.0 + Mingw3.81,

    I'm trying to build a nice static version of a project because I want to learn how to deploy static builds. I've followed this here reference on how to build a static version of Qt; I've commented out line 61 of qwtconfig.pri prior to building qwt, ensuring that I use the static qmake as well and it would appear that I was successful (quickly built a Qt app using my qt-static environment which simply just showed a label and it seems to work on my VM; the exe is around 6 meg).

    The problem arises when I try to add static Qwt to my project. It's a very similar symptom to what is described in this thread, but I made sure I compiled both Qt and Qwt using the static qmake.exe.

    The errors I get are "undefined reference to whatevs" errors. Example:

    Qt Code:
    1. C:\Qt\qwt-static\lib\libqwt.a(qwt_color_map.o):qwt_color_map.cpp::-1: error: undefined reference to `_imp___Z6qIsNaNd'
    2. C:\Qt\qwt-static\lib\libqwt.a(qwt_color_map.o):qwt_color_map.cpp:(.text$_ZN7QVectorIdEC1Ei[QVector<double>::QVector:-1: error: undefined reference to `_imp___Z7qMemSetPvij'
    3. C:\Qt\qwt-static\lib\libqwt.a(qwt_color_map.o):qwt_color_map.cpp:(.text$_ZN7QVectorIN17QwtLinearColorMap10ColorStops9ColorStopEE6resizeEi[QVector<QwtLinearColorMap::ColorStops::ColorStop>::resize:-1: error: undefined reference to `_imp___ZN11QVectorData4growEiiib'
    To copy to clipboard, switch view to plain text mode 

    I get over 2000 of them.

    Here is my .pro file:

    Qt Code:
    1. #-------------------------------------------------
    2. #
    3. # Project created by QtCreator 2014-08-26T15:31:14
    4. #
    5. #-------------------------------------------------
    6.  
    7. static {
    8. CONFIG += static
    9. DEFINES += STATIC
    10. message("~~~ static build ~~~")
    11. mac: TARGET = $$join(TARGET,,,_static)
    12. win32: TARGET = $$join(TARGET,,,s)
    13. }
    14.  
    15. CONFIG(debug, debug|release) {
    16. mac: TARGET = $$join(TARGET,,,_debug)
    17. win32: TARGET = $$join(TARGET,,,d)
    18. }
    19.  
    20.  
    21. TARGET = lolpotato
    22. TEMPLATE = app
    23.  
    24.  
    25. SOURCES += main.cpp\
    26. mw.cpp \
    27. rasterplot.cpp
    28.  
    29. HEADERS += mw.h \
    30. rasterplot.h
    31.  
    32. FORMS += mw.ui
    33.  
    34. INCLUDEPATH += C:/Qt/qwt-static/src
    35. DEPENDPATH += $$INCLUDEPATH
    36. #LIBS += -L"C:\Qt\qwt-static\lib" -lqwt # I tried this as well, to no avail
    37. LIBS += C:\Qt\qwt-static\lib\libqwt.a
    To copy to clipboard, switch view to plain text mode 

    It is worth to note that the code used in this project compiles and runs fine in the dynamic version of Qt and Qwt. There are no syntax errors; it is only at the very end of the compile that I get these linker errors in static mode.

    What could I be missing/what would I be doing wrong?

    Edit: Oh yeah and when I try to build the examples in my qwt-static folder, the cpuplot.exe compiles, but I get undefined reference errors as well. The resulting cpuplot.exe, despite the fact that it is over 8 meg in size, still asks for mingwm10.dll on my VM.

    Edit 2: After realizing that make install copies files to C:\Qwt-6.0.2-svn I tried modifying the project file to point the LIBS and INCLUDEPATH to that folder, but again I was unsuccessful.

    Thanks in advance.


    Regards,
    Mr_Cloud
    Last edited by Mr_Cloud; 27th August 2014 at 09:18.

Similar Threads

  1. QWT integration with static QT build
    By DizzyMoods in forum Qwt
    Replies: 5
    Last Post: 21st October 2011, 14:14
  2. examples - static link
    By fukjo in forum Qwt
    Replies: 1
    Last Post: 14th July 2011, 18:23
  3. Replies: 1
    Last Post: 15th August 2010, 13:12
  4. Replies: 1
    Last Post: 14th January 2010, 00:35
  5. Qt 4.1.0 - static examples run with errors!
    By Elder Orb in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2006, 10:40

Tags for this Thread

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.