PDA

View Full Version : Static build + examples + Qt project integration



Mr_Cloud
27th August 2014, 08:05
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 (https://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_ gcc) 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 (http://www.qtcentre.org/threads/45263-QWT-integration-with-static-QT-build?p=206102#post206102) 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:




C:\Qt\qwt-static\lib\libqwt.a(qwt_color_map.o):qwt_color_map .cpp::-1: error: undefined reference to `_imp___Z6qIsNaNd'
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'
C:\Qt\qwt-static\lib\libqwt.a(qwt_color_map.o):qwt_color_map .cpp:(.text$_ZN7QVectorIN17QwtLinearColorMap10Colo rStops9ColorStopEE6resizeEi[QVector<QwtLinearColorMap::ColorStops::ColorStop>::resize:-1: error: undefined reference to `_imp___ZN11QVectorData4growEiiib'



I get over 2000 of them.

Here is my .pro file:




#-------------------------------------------------
#
# Project created by QtCreator 2014-08-26T15:31:14
#
#-------------------------------------------------

static {
CONFIG += static
DEFINES += STATIC
message("~~~ static build ~~~")
mac: TARGET = $$join(TARGET,,,_static)
win32: TARGET = $$join(TARGET,,,s)
}

CONFIG(debug, debug|release) {
mac: TARGET = $$join(TARGET,,,_debug)
win32: TARGET = $$join(TARGET,,,d)
}


TARGET = lolpotato
TEMPLATE = app


SOURCES += main.cpp\
mw.cpp \
rasterplot.cpp

HEADERS += mw.h \
rasterplot.h

FORMS += mw.ui

INCLUDEPATH += C:/Qt/qwt-static/src
DEPENDPATH += $$INCLUDEPATH
#LIBS += -L"C:\Qt\qwt-static\lib" -lqwt # I tried this as well, to no avail
LIBS += C:\Qt\qwt-static\lib\libqwt.a




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