I don't have TARGET nor TEMPLATE in my .pro but appart from that you are right.
In my code, I only create a qwt object.
When I start the program, I have "realloc(): invalid pointer" followed by the backtrace and the memory map.
I don't have TARGET nor TEMPLATE in my .pro but appart from that you are right.
In my code, I only create a qwt object.
When I start the program, I have "realloc(): invalid pointer" followed by the backtrace and the memory map.
I just figured out that I had let the lines
Qt Code:
unix|win32: LIBS += -L$$PWD/../../../../../usr/local/qwt-6.1.0/lib/ -lqwt #INCLUDEPATH += $$PWD/../../../../../usr/local/qwt-6.1.0/include #DEPENDPATH += $$PWD/../../../../../usr/local/qwt-6.1.0/includeTo copy to clipboard, switch view to plain text mode
in the .pro while I thought I had suppressed them when wysota told me to.
Actually, the code only compiled because of them. New project, new try, new errors ; there I have (the most simple I can) :
Qt Code:
QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = qwt_test TEMPLATE = app CONFIG += qwt # hand added SOURCES += main.cppTo copy to clipboard, switch view to plain text mode
for the .pro
Qt Code:
#include <QApplication> #include<qwt_compass.h> int main(int argc, char *argv[]) { //MainWindow w; //w.show(); QwtCompass compass; compass.show(); return a.exec(); }To copy to clipboard, switch view to plain text mode
for main.cpp
That code does not compile. It returns :
Qt Code:
In function `MainWindow::on_actionTest_triggered()': error: undefined reference to `QwtCompass::QwtCompass(QWidget*)' error: collect2: ld returned 1 exit statusTo copy to clipboard, switch view to plain text mode
I had all reinstalled following the steps online, no more no less.
(First installation I had copied the .so but I was told I should not have.)
It is still "/usr/local/qwt-6.1.0/features/" since I have changed it with "qmake -set QMAKEFEATURES" and the right path. :-)
1. Make sure this is the right qmake that you are using
2. Make sure the directory contains the qwt.prf file
3. Make sure the qwt.prf file contains a reference to the qwt library
4. Show us the last compiler invocation for your project.
I compile with QtCreator ; Qt Version is autodetected with location of qmake the same as what I used to compile qwt. So this is OK I think.1. Make sure this is the right qmake that you are using
Which directory ? :s2. Make sure the directory contains the qwt.prf file
If it is qwt_root/features, yes it contains qwt.prf
it contains :3. Make sure the qwt.prf file contains a reference to the qwt library
Qt Code:
include ( ./qwtconfig.pri ) include ( ./qwtfunctions.pri ) contains(QWT_CONFIG, QwtDll) { DEFINES *= QWT_DLL } contains(QWT_CONFIG, QwtSvg) { QT *= svg } else { DEFINES *= QWT_NO_SVG } contains(QWT_CONFIG, QwtFramework) { INCLUDEPATH *= $${QWT_INSTALL_LIBS}/qwt.framework/Headers LIBS *= -F$${QWT_INSTALL_LIBS} } else { INCLUDEPATH *= $${QWT_INSTALL_HEADERS} LIBS *= -L$${QWT_INSTALL_LIBS} } qwtAddLibrary(qwt)To copy to clipboard, switch view to plain text mode
I compile in QtCreator. What should I show you ?4. Show us the last compiler invocation for your project.
I tell you what I can ! QtCreator tells me it uses qmake from the same path I have used to make qwt ; I believe that is what you ask. But as long as I am not sure, I tell you that I think it is OK. No need to be aggressive. Just tell me if this is your meaning of "the right qmake" or not !Don't think, please. Check.
So yes as I said.The one returned by qmake -query QMAKEFEATURES
The last compiler invocation (from the "compiler messages" pane).Qt Code:
14:48:37: Configuration unchanged, skipping qmake step. 14:48:37: Starting: "/usr/bin/make" g++ -m64 -Wl,-rpath,/home/developpeur/Qt5.0.2/5.0.2/gcc_64 -Wl,-rpath,/home/developpeur/Qt5.0.2/5.0.2/gcc_64/lib -o qwt_test main.o -L/usr/X11R6/lib64 -L/home/developpeur/Qt5.0.2/5.0.2/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread main.o: In function `main': /home/developpeur/developpement/stageCamille/build-qwt_test-Desktop_Qt_5_0_2_GCC_64bit-Debug/../qwt_test/main.cpp:9: undefined reference to `QwtCompass::QwtCompass(QWidget*)' /home/developpeur/developpement/stageCamille/build-qwt_test-Desktop_Qt_5_0_2_GCC_64bit-Debug/../qwt_test/main.cpp:12: undefined reference to `QwtCompass::~QwtCompass()' /home/developpeur/developpement/stageCamille/build-qwt_test-Desktop_Qt_5_0_2_GCC_64bit-Debug/../qwt_test/main.cpp:12: undefined reference to `QwtCompass::~QwtCompass()' collect2: ld returned 1 exit status make: *** [qwt_test] Error 1 14:48:37: The process "/usr/bin/make" exited with code 2. Error while building/deploying project qwt_test (kit: Desktop Qt 5.0.2 GCC 64bit) When executing step 'Make' 14:48:38: Elapsed time: 00:00.To copy to clipboard, switch view to plain text mode
I am not being aggressive. I'm asking you to make sure you are using the same qmake for compilation of your applications as you used to change the QMAKEFEATURES variable.
You can see there are no lines here that try to link your application against Qwt. This can happen as a result of one of two things:Qt Code:
14:48:37: Configuration unchanged, skipping qmake step. 14:48:37: Starting: "/usr/bin/make" g++ -m64 -Wl,-rpath,/home/developpeur/Qt5.0.2/5.0.2/gcc_64 -Wl,-rpath,/home/developpeur/Qt5.0.2/5.0.2/gcc_64/lib -o qwt_test main.o -L/usr/X11R6/lib64 -L/home/developpeur/Qt5.0.2/5.0.2/gcc_64/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread main.o: In function `main': /home/developpeur/developpement/stageCamille/build-qwt_test-Desktop_Qt_5_0_2_GCC_64bit-Debug/../qwt_test/main.cpp:9: undefined reference to `QwtCompass::QwtCompass(QWidget*)' /home/developpeur/developpement/stageCamille/build-qwt_test-Desktop_Qt_5_0_2_GCC_64bit-Debug/../qwt_test/main.cpp:12: undefined reference to `QwtCompass::~QwtCompass()' /home/developpeur/developpement/stageCamille/build-qwt_test-Desktop_Qt_5_0_2_GCC_64bit-Debug/../qwt_test/main.cpp:12: undefined reference to `QwtCompass::~QwtCompass()' collect2: ld returned 1 exit status make: *** [qwt_test] Error 1 14:48:37: The process "/usr/bin/make" exited with code 2. Error while building/deploying project qwt_test (kit: Desktop Qt 5.0.2 GCC 64bit) When executing step 'Make' 14:48:38: Elapsed time: 00:00.To copy to clipboard, switch view to plain text mode
1. You don't have a CONFIG += qwt line in your project file
2. The qwt.prf file is not found by qmake.
You need to verify both of these yourself as we have no access to your machine. You can use qmake's message() function to test whether the prf file is being executed or not (e.g. by putting message("I am executed") in qwt.prf and reruning qmake).
I have added message("I am executed") in qwt.prf, executing qmake and watching the result on the compile output. I have this :
Qt Code:
16:14:47: Running steps for project qwt_test... 16:14:47: Starting: "/home/developpeur/Qt5.0.2/5.0.2/gcc_64/bin/qmake" /home/developpeur/developpement/stageCamille/qwt_test/qwt_test.pro -r -spec linux-g++-64 CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug 16:14:47: The process "/home/developpeur/Qt5.0.2/5.0.2/gcc_64/bin/qmake" exited normally. 16:14:47: Elapsed time: 00:00.To copy to clipboard, switch view to plain text mode
Is it normal that "CONFIG+=qwt" is not written there ? It is actually in the .pro.
There is no mention of the message so I guess qwt.prf is not found.
Does /home/developpeur/developpement/stageCamille/qwt_test/qwt_test.pro file contain a "CONFIG += qwt" line?
yes, the line always is there.
Please go to project build settings, expand the qmake pane and in the extra arguments field enter -query QMAKEFEATURES. Then ask Creator to rerun qmake and see if a proper path is reported.
I cannot find where there is an extra arguments fields.
Should it be there ?
Screenshot from 2013-06-26 10:49:09.jpg
There is no other settings, is there ?
In the project settings, not in Creator settings.
This is starting to be a thread on Qt Creator rather than on Qwt...
I found it, sorry.
It now build with "qmake qwt_test.pro -r -spec linux-g++-64 -query QMAKEFEATURES".
It tells me
Unknown option -query
11:35:46: The process "/home/developpeur/Qt5.0.2/5.0.2/gcc_64/bin/qmake" exited with code 1.
Ok, forget it. Open the console, add type in:
/home/developpeur/Qt5.0.2/5.0.2/gcc_64/bin/qmake -query QMAKEFEATURES
Does it report the proper path?
It reports "**Unknown**"
So you were using the wrong qmake (despite what you said earlier).
Call /home/developpeur/Qt5.0.2/5.0.2/gcc_64/bin/qmake -set QMAKEFEATURES <pathtoqwt>/features and all should be fine.
BTW. Be sure to build Qwt with that exact qmake.
Bookmarks