problem bei Compiler
Verfasst: 18. März 2011 17:51
Hallo zusammen,
ich habe ein Beispiel von einem QT-Buch eins zu eins kopiert und beim Komplieren bekomme ich die folgende Fehlermeldung:
main.o: In function `main':
main.cpp:(.text+0x79): undefined reference to `FunctionPlot::FunctionPlot(int, QWidget*, char const*)'
main.cpp:(.text+0xef): undefined reference to `FunctionPlot::setValue(int, valuePair)'
main.cpp:(.text+0x10f): undefined reference to `FunctionPlot::plotIt()'
collect2: ld returned 1 exit status
hier sind Codeabschnitte:
functionplot.h
#ifndef FUNCTIONPLOT_H
#define FUNCTIONPLOT_H
#include <qapplication.h>
#include <qwidget.h>
typedef struct {
double x,y;
} valuePair;
class FunctionPlot: public QWidget{
public:
FunctionPlot(int n, QWidget *p=0, const char *name=0);
~FunctionPlot() {delete [] values;}
void plotIt(void);
functionplot.cpp
#include <qpainter.h>
#include <stdio.h>
#include "functionplot.h"
FunctionPlot::FunctionPlot( int n, QWidget *p, const char *name )
: QWidget( p, name ) {
valueNo = n;
values = new valuePair [n];
for ( int i=0; i<n; i++ )
values.x = values.y = 0.0;
plotViewSet = false;
}
void FunctionPlot::plotIt( void ) {
if ( !plotViewSet ) {
min.cpp:
int main( int argc, char *argv[])
{
QApplication myapp(argc, argv);
const double pi=4*atan(1);
valuePair v;
int i=0, z=0;
double x=0.0;
for(x=-2*pi; x<3*pi;x+=0.01){
z++;
}
FunctionPlot* plotWindow= new FunctionPlot(z);
plotWindow->resize(500,500);
for(v.x=-2*i; v.x<3*pi;v.x+=0.01){
v.y= sin(v.x);
plotWindow->setValue(i, v);
i++;}
plotWindow->plotIt();
//myapp.setMainWidget(plotWindow);
plotWindow->show();
ich bin für jede Hilfe sehr dankbar.
PC:
ich arbeite mt qt4.
[/code]
ich habe ein Beispiel von einem QT-Buch eins zu eins kopiert und beim Komplieren bekomme ich die folgende Fehlermeldung:
main.o: In function `main':
main.cpp:(.text+0x79): undefined reference to `FunctionPlot::FunctionPlot(int, QWidget*, char const*)'
main.cpp:(.text+0xef): undefined reference to `FunctionPlot::setValue(int, valuePair)'
main.cpp:(.text+0x10f): undefined reference to `FunctionPlot::plotIt()'
collect2: ld returned 1 exit status
hier sind Codeabschnitte:
functionplot.h
#ifndef FUNCTIONPLOT_H
#define FUNCTIONPLOT_H
#include <qapplication.h>
#include <qwidget.h>
typedef struct {
double x,y;
} valuePair;
class FunctionPlot: public QWidget{
public:
FunctionPlot(int n, QWidget *p=0, const char *name=0);
~FunctionPlot() {delete [] values;}
void plotIt(void);
functionplot.cpp
#include <qpainter.h>
#include <stdio.h>
#include "functionplot.h"
FunctionPlot::FunctionPlot( int n, QWidget *p, const char *name )
: QWidget( p, name ) {
valueNo = n;
values = new valuePair [n];
for ( int i=0; i<n; i++ )
values.x = values.y = 0.0;
plotViewSet = false;
}
void FunctionPlot::plotIt( void ) {
if ( !plotViewSet ) {
min.cpp:
int main( int argc, char *argv[])
{
QApplication myapp(argc, argv);
const double pi=4*atan(1);
valuePair v;
int i=0, z=0;
double x=0.0;
for(x=-2*pi; x<3*pi;x+=0.01){
z++;
}
FunctionPlot* plotWindow= new FunctionPlot(z);
plotWindow->resize(500,500);
for(v.x=-2*i; v.x<3*pi;v.x+=0.01){
v.y= sin(v.x);
plotWindow->setValue(i, v);
i++;}
plotWindow->plotIt();
//myapp.setMainWidget(plotWindow);
plotWindow->show();
ich bin für jede Hilfe sehr dankbar.
PC:
ich arbeite mt qt4.
[/code]