und zwar habe mal das Qwt Extension runtergeladen und die Examples funktionieren auch sehr gut und es hat mir ein Example mir sehr gut gefallen und habe die Klasse in mein projekt eingebunden und wollte es mal als Widget mit aufblenden lassen und beim kompilieren gibt er mit diesen Fehler heraus:
Ich kanns eigentlich verstehen, weil das Example alleine funktioniert und nur wenn ich das jetzt in meine .h mit einbinde gibs einen Fehler!C:\PROGRAMMIEREN\CPP_PROJECTS\qserver>make
make -f Makefile.Release
make[1]: Entering directory `C:/PROGRAMMIEREN/CPP_PROJECTS/qserver'
g++ -c -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_D
LL -DQWT_DLL -DQT_DLL -DQT_NO_DEBUG -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_SQL_L
IB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:/Qt/4.1.
1/include/QtCore" -I"C:/Qt/4.1.1/include/QtGui" -I"C:/Qt/4.1.1/include/QtSql" -I
"C:/Qt/4.1.1/include/Qt3Support" -I"C:/Qt/4.1.1/include" -I"..\..\..\qwt\include
" -I"C:/Qt/4.1.1/include/ActiveQt" -I"release" -I"." -I"C:/Qt/4.1.1/mkspecs/win3
2-g++" -o release\main.o main.cpp
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h: In member function `
typename QHash<K, V>::Node** QHash<K, V>::findNode(const Key&, uint*) const [wit
h Key = qreal, T = QHashDummyValue]':
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:620: instantiated f
rom `typename QHash<K, V>::iterator QHash<K, V>::insert(const Key&, const T&) [w
ith Key = qreal, T = QHashDummyValue]'
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qset.h:105: instantiated fr
om `QSet<T>::const_iterator QSet<T>::insert(const T&) [with T = qreal]'
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qset.h:204: instantiated fr
om `QSet<T> QList<T>::toSet() const [with T = qreal]'
../../../qwt/include/qwt_scale_div.h:43: instantiated from here
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:736: error: call of o
verloaded `qHash(const double&)' is ambiguous
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:37: note: candidates
are: uint qHash(char)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:38: note:
uint qHash(uchar)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:39: note:
uint qHash(signed char)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:40: note:
uint qHash(ushort)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:41: note:
uint qHash(short int)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:42: note:
uint qHash(uint)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:43: note:
uint qHash(int)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:45: note:
uint qHash(ulong)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:52: note:
uint qHash(long int)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:54: note:
uint qHash(quint64)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:61: note:
uint qHash(qint64)
C:/Qt/4.1.1/include/QtCore/../../src/corelib/tools/qhash.h:62: note:
uint qHash(QChar)
make[1]: *** [release\main.o] Error 1
make[1]: Leaving directory `C:/PROGRAMMIEREN/CPP_PROJECTS/qserver'
make: *** [release] Error 2
So sieht mein config file aus:
Habs mir eigentlich von der exmples.pri bisschen abgeguckt wie die ihre config gemacht haben und das müsste eigentlich funktionieren######################################################################
# Automatically generated by qmake (2.00a) Fr 31. Mrz 16:36:36 2006
######################################################################
CONFIG += thread
CONFIG += warn_on
CONFIG += release
INCLUDEPATH += ../../../qwt/include
DEPENDPATH += ../../../qwt/include
unix:LIBS += -L../../../qwt/lib -lqwt
win32:DEFINES += QT_DLL QWT_DLL
win32-msvc:LIBS += ../../../qwt/lib/qwt5.lib
win32-msvc.net:LIBS += ../../../qwt/lib/qwt5.lib
win32-msvc2005:LIBS += ../../../qwt/lib/qwt5.lib
win32-g++:LIBS += -L../../../qwt/lib -lqwt5
# DEFINES += QT_NO_CAST_ASCII
# DEFINES += QT_NO_CAST_TO_ASCII
TEMPLATE = app
TARGET +=
QT += sql qt3support
# Input
HEADERS += qserver.h qservertype.h qloader.h qcpu_plot.h qplot_widget.h
SOURCES += main.cpp qserver.cpp qservertype.cpp qloader.cpp qcpu_plot.cpp qplot_widget.cpp
Wenn ich jetzt die qplot_widget.h (per #include) aus meiner qserver.h wieder entferne ist alles wieder in Butter
Ich weiß nicht woran das liegt :/? Nach dem Code liegts eher an der qhash.h die Probleme macht.
qplot_widget.h
Code: Alles auswählen
#ifndef QPLOT_WIDGET
#define QPLOT_WIDGET
#include <stdlib.h>
#include <qwt_plot.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_curve.h>
#include <qwt_scale_widget.h>
#include <qwt_legend.h>
#include <qwt_scale_draw.h>
#include <qwt_math.h>
const int PLOT_SIZE = 201; // 0 to 200
class DataPlot : public QwtPlot
{
public:
DataPlot();
protected:
virtual void timerEvent(QTimerEvent *e);
private:
void alignScales();
double d_x[PLOT_SIZE];
double d_y[PLOT_SIZE];
double d_z[PLOT_SIZE];
};
#endifCode: Alles auswählen
#include "qplot_widget.h"
DataPlot::DataPlot()
{
alignScales();
// Initialize data
for (int i = 0; i< PLOT_SIZE; i++)
{
d_x[i] = 0.5 * i; // time axis
d_y[i] = 0;
d_z[i] = 0;
}
// Assign a title
setTitle("Another Simple QwtPlot Demonstration");
insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
// Insert new curves
QwtPlotCurve *cRight = new QwtPlotCurve("Data Moving Right");
cRight->attach(this);
QwtPlotCurve *cLeft = new QwtPlotCurve("Data Moving Left");
cLeft->attach(this);
// Set curve styles
cRight->setPen(QPen(Qt::red));
cLeft->setPen(QPen(Qt::blue));
// Attach (don't copy) data. Both curves use the same x array.
cRight->setRawData(d_x, d_y, PLOT_SIZE);
cLeft->setRawData(d_x, d_z, PLOT_SIZE);
// Insert zero line at y = 0
QwtPlotMarker *mY = new QwtPlotMarker();
mY->setLabelAlignment(Qt::AlignRight|Qt::AlignTop);
mY->setLineStyle(QwtPlotMarker::HLine);
mY->setYValue(0.0);
mY->attach(this);
// Set axis titles
setAxisTitle(QwtPlot::xBottom, "Time/seconds");
setAxisTitle(QwtPlot::yLeft, "Values");
// Generate timer event every 50ms
(void)startTimer(50);
}
void DataPlot::alignScales()
{
// The code below shows how to align the scales to
// the canvas frame, but is also a good example demonstrating
// why the spreaded API needs polishing.
canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
canvas()->setLineWidth(1);
for ( int i = 0; i < QwtPlot::axisCnt; i++ )
{
QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
if ( scaleWidget )
scaleWidget->setMargin(0);
QwtScaleDraw *scaleDraw = (QwtScaleDraw *)axisScaleDraw(i);
if ( scaleDraw )
scaleDraw->enableComponent(QwtAbstractScaleDraw::Backbone, false);
}
}
//
// Generate new values every 500ms.
//
void DataPlot::timerEvent(QTimerEvent *)
{
static double phase = 0.0;
if (phase > (M_PI - 0.0001))
phase = 0.0;
// y moves from left to right:
// Shift y array right and assign new value to y[0].
for ( int i = PLOT_SIZE - 1; i > 0; i-- )
d_y[i] = d_y[i-1];
d_y[0] = sin(phase) * (-1.0 + 2.0 * double(0) / double(RAND_MAX));
for ( int j = 0; j < PLOT_SIZE - 1; j++ )
d_z[j] = d_z[j+1];
d_z[PLOT_SIZE - 1] = 0.8 - (2.0 * phase/M_PI) + 0.4 *
double(1) / double(RAND_MAX);
// update the display
replot();
phase += M_PI * 0.02;
}