Seite 1 von 4

[gelöst] qwt unter qt 2009.03

Verfasst: 17. August 2009 18:45
von cimbomgs
Hallo,

kann mir jemand sagen wie ich QWT in QT 2009.03 integrieren kann?

Ich arbeite mit qt-sdk-win-opensource-2009.03. Jetzt wollte ich Diagramme erstellen und habe gesehn dass es dafür QWT gibt.
Aber wie integriere ich QWT in QT 2009.03?

Wie benutze ich die QWT-Bibleotheken?

Vielen Dank

Verfasst: 18. August 2009 09:44
von cimbomgs
ich komm einfach nicht weiter :cry:

ich bekomme lauter Fehler. Ich will einfaches Example-Programm erstellen aber es klappt nicht.

simple.cpp:2:22: qwt_plot.h: No such file or directory
simple.cpp:3:29: qwt_plot_marker.h: No such file or directory
simple.cpp:4:28: qwt_plot_curve.h: No such file or directory
simple.cpp:5:24: qwt_legend.h: No such file or directory
simple.cpp:6:22: qwt_data.h: No such file or directory
simple.cpp:7:22: qwt_text.h: No such file or directory
simple.cpp:8:22: qwt_math.h: No such file or directory

Wie kann ich die Header einbinden?

Was muss ich machen?

Setting up a MinGW/Qt only environment...
-- QTDIR set to C:\Qt\2009.03\qt
-- PATH set to C:\Qt\2009.03\qt\bin
-- Adding C:\Qt\2009.03\bin to PATH
-- Adding C:\WINDOWS\System32 to PATH
-- QMAKESPEC set to win32-g++
...

C:\Qt\qwt-5.2.0\examples>cd simple_plot

C:\Qt\qwt-5.2.0\examples\simple_plot>qmake -project

C:\Qt\qwt-5.2.0\examples\simple_plot>qmake simple_plot.pro

C:\Qt\qwt-5.2.0\examples\simple_plot>mingw32-make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Qt/qwt-5.2.0/examples/simple_plot'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..
\..\2009.03\qt\include\QtCore" -I"..\..\..\2009.03\qt\include\QtGui" -I"..\..\..
\2009.03\qt\include" -I"." -I"..\..\..\2009.03\qt\include\ActiveQt" -I"debug" -I
"..\..\..\2009.03\qt\mkspecs\win32-g++" -o debug\simple.o simple.cpp
simple.cpp:2:22: qwt_plot.h: No such file or directory
simple.cpp:3:29: qwt_plot_marker.h: No such file or directory
simple.cpp:4:28: qwt_plot_curve.h: No such file or directory
simple.cpp:5:24: qwt_legend.h: No such file or directory
simple.cpp:6:22: qwt_data.h: No such file or directory
simple.cpp:7:22: qwt_text.h: No such file or directory
simple.cpp:8:22: qwt_math.h: No such file or directory
simple.cpp:18: error: expected class-name before '{' token
simple.cpp:33: error: ISO C++ forbids declaration of `QwtData' with no type
simple.cpp:33: error: `QwtData' declared as a `virtual' field
simple.cpp:33: error: expected `;' before '*' token
simple.cpp:38: error: expected `;' before "virtual"
simple.cpp:58: error: expected class-name before '{' token
simple.cpp: In constructor `Plot::Plot()':
simple.cpp:66: error: `setTitle' was not declared in this scope
simple.cpp:67: error: `QwtLegend' has not been declared
simple.cpp:67: error: `QwtPlot' has not been declared
simple.cpp:67: error: `RightLegend' was not declared in this scope
simple.cpp:67: error: `insertLegend' was not declared in this scope
simple.cpp:70: error: `xBottom' was not declared in this scope
simple.cpp:70: error: `setAxisTitle' was not declared in this scope
simple.cpp:71: error: `yLeft' was not declared in this scope
simple.cpp:74: error: `QwtPlotCurve' was not declared in this scope
simple.cpp:74: error: `cSin' was not declared in this scope
simple.cpp:74: error: `QwtPlotCurve' is not a type
simple.cpp:76: error: `QwtPlotItem' has not been declared
simple.cpp:76: error: `RenderAntialiased' was not declared in this scope
simple.cpp:78: error: invalid use of undefined type `struct QPen'
../../../2009.03/qt/include/QtGui/../../src/gui/kernel/qwindowdefs.h:73: error:
forward declaration of `struct QPen'
simple.cpp:81: error: `cCos' was not declared in this scope
simple.cpp:81: error: `QwtPlotCurve' is not a type
simple.cpp:83: error: `QwtPlotItem' has not been declared
simple.cpp:85: error: invalid use of undefined type `struct QPen'
../../../2009.03/qt/include/QtGui/../../src/gui/kernel/qwindowdefs.h:73: error:
forward declaration of `struct QPen'
simple.cpp:96: error: `QwtPlotMarker' was not declared in this scope
simple.cpp:96: error: `mY' was not declared in this scope
simple.cpp:96: error: `QwtPlotMarker' is not a type
simple.cpp:99: error: `QwtPlotMarker' is not a class or namespace
simple.cpp:99: error: `HLine' was not declared in this scope
simple.cpp:104: error: `mX' was not declared in this scope
simple.cpp:104: error: `QwtPlotMarker' is not a type
simple.cpp:108: error: `QwtPlotMarker' is not a class or namespace
simple.cpp:108: error: `VLine' was not declared in this scope
simple.cpp:109: error: invalid use of undefined type `struct QPen'
../../../2009.03/qt/include/QtGui/../../src/gui/kernel/qwindowdefs.h:73: error:
forward declaration of `struct QPen'
simple.cpp:66: warning: unused variable 'setTitle'
simple.cpp:67: warning: unused variable 'RightLegend'
simple.cpp:67: warning: unused variable 'insertLegend'
simple.cpp:70: warning: unused variable 'xBottom'
simple.cpp:71: warning: unused variable 'yLeft'
simple.cpp:99: warning: unused variable 'HLine'
simple.cpp:108: warning: unused variable 'VLine'
simple.cpp: In function `int qMain(int, char**)':
simple.cpp:122: error: 'class Plot' has no member named 'resize'
simple.cpp:123: error: 'class Plot' has no member named 'show'
mingw32-make[1]: *** [debug/simple.o] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/qwt-5.2.0/examples/simple_plot'
mingw32-make: *** [debug] Error 2

C:\Qt\qwt-5.2.0\examples\simple_plot>
Danke...

Verfasst: 18. August 2009 13:19
von erpheus
so wie es ausschaut hast du die qwt-library nicht richtig eingebunden. Nutz hierzu die Foren suche. Da gibt es schon genug Threads.

Verfasst: 18. August 2009 13:21
von cimbomgs
ich habe alle Beiträge, die ich im Forum finden konnte, gelesen aber nichts entdeckt was mir weiter hilft

Verfasst: 18. August 2009 14:09
von Mani99
Poste mal deine *.pro datei, in welche du qwt verwenden möchtest, sowie die pfade wo die qwt header und .dll/.so liegen!

Verfasst: 18. August 2009 14:11
von MiKla
Ich habe bei mir in der Pro Datei folgendes stehen:

Code: Alles auswählen

INCLUDEPATH += /usr/local/qwt-5.2.0/include
LIBS += -L/usr/local/qwt-5.2.0/lib/ \
    -lqwt
Da musst Du Deine Pfade anpassen und dann sollte das funktionieren.
Übrigens ist das ein generelles Vorgehen. Egal welche externe Lib man benutzt, man muss immer Include und Lib Pfade setzen.

Michael

Verfasst: 18. August 2009 15:12
von cimbomgs
ic benutze den QT Creater..

QWT-Verzeichnis ist C:\QWT-5.2.0

wie müsste ich den Pfad eingeben?:
INCLUDEPATH += c:\qwt-5.2.0\include
LIBS += c:\qwt-5.2.0\lib\ \
-lqwt
qwt header:
C:\QWT-5.2.0\src

qwt lib:
C:\QWT-5.2.0\lib

Verfasst: 18. August 2009 15:26
von Mani99
Also ich mach das immer so:

Code: Alles auswählen

win*{
  INCLUDEPATH += C:\QWT-5.2.0\src
  LIBS += C:\QWT-5.2.0\lib
}
LIBS += -lqwt 

Verfasst: 18. August 2009 15:40
von MiKla
Du hast die qwt Quellen schon runter geladeb und kompiliert und installiert (make, make install)?
Wenn nein, hole das nach. Dann weist Du auch wo die Header und Lib's liegen. Dann hast Du für Dein Projekt eine *.pro Datei. Diese öffnen und die Include und Lib Pfade entsprechend setzen.

Michael

Verfasst: 18. August 2009 17:46
von cimbomgs
ich bin ein Stück weiter gekommen aber wenn ich jetzt auf Ausführen klicke dann erschein folgender Fehler:

Code: Alles auswählen

:-1: error: collect2: ld returned 1 exit status
das ist alles was als Fehler angegeben wird

Verfasst: 18. August 2009 17:51
von MiKla
Unter "Ausgabe der Anwendung" findest Du noch mehr Hinweise. Aber so wies aussieht ein Linker Problem.

Michael

Verfasst: 18. August 2009 17:58
von cimbomgs
arbeitest du auch mit QT Creater?
Mani99 hat geschrieben:Also ich mach das immer so:

Code: Alles auswählen

win*{
  INCLUDEPATH += C:\QWT-5.2.0\src
  LIBS += C:\QWT-5.2.0\lib
}
LIBS += -lqwt 

Verfasst: 18. August 2009 17:59
von cimbomgs
Michael.Klank hat geschrieben:Unter "Ausgabe der Anwendung" findest Du noch mehr Hinweise. Aber so wies aussieht ein Linker Problem.

Michael

Starte D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe...

D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe beendet, Rückgabewert 0



Starte D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe...

D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe beendet, Rückgabewert 0



Starte D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe...

D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe beendet, Rückgabewert 0



Starte D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe...

D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe beendet, Rückgabewert 0

Verfasst: 18. August 2009 18:04
von cimbomgs
so sieht die pro-datei aus:

Code: Alles auswählen

#-------------------------------------------------
#
# Project created by QtCreator 2009-08-18T17:29:30
#
#-------------------------------------------------

TARGET = QWT_Test
TEMPLATE = app


SOURCES += main.cpp\
        qwt_test.cpp

HEADERS  += qwt_test.h

FORMS    += qwt_test.ui

win*{
  INCLUDEPATH += C:\QWT-5.2.0\src
  LIBS += C:\QWT-5.2.0\lib
}
LIBS += -lqwt

Verfasst: 18. August 2009 18:12
von MiKla
:-1: error: collect2: ld returned 1 exit status
und
Starte D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe...
D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe beendet, Rückgabewert 0
Starte D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe...
D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe beendet, Rückgabewert 0
Starte D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe...
D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe beendet, Rückgabewert 0
Starte D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe...
D:\QT_Projekte\QWT_Test\debug\QWT_Test.exe beendet, Rückgabewert 0
haben nicht miteinander zu tun. Wenn der obige Fehler kommt hast Du mit Sicherheit eine andere Ausgabe. Aber wenn Du "QWT_Test.exe" hast, hat doch beim kompilieren alles geklappt. Nur darfst Du debug und release Versionen nicht mischen, was bei Dir so aussieht. Du hast bestimmt im QtCreator Debug angewählt. Also musst Du qwt auch in debug Mode kompilieren, einstellbar in "qwtconfig.pri".

Die *.pro Datei musst Du auch anpassen. Hier ein Auszug von meiner:

Code: Alles auswählen

win32{
  TEMPLATE        =   vcapp
	INCLUDEPATH     +=  C:\qt\Qwt\include
	DEFINES         +=  QT_DLL \
    		            	QWT_DLL 
	RESOURCES       +=  QScope.qrc
	RC_FILE 				= 	QScope.rc
	Debug{    
		CONFIG        +=  console
		LIBS					+=  -LC:\qt\Qwt\lib \
											-lqwtd
	}
	Release{
		CONFIG        -=  console
		LIBS					+=	-LC:\qt\Qwt\lib \
											-lqwt
	}
} 
Michael