Hello Everyone,
I am having trouble compiling the following code below:
cpp file:
#include <QApplication>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_symbol.h>
#include <qwt_legend.h>
int main(int argc, char *argv[])
{
plot.setTitle( "Plot Demo" );
plot.setCanvasBackground( Qt::white );
plot.
setAxisScale( QwtPlot::yLeft,
0.0,
10.0);
grid->attach( &plot );
curve->setTitle( "Pixel Count" );
curve->setPen( Qt::blue, 4 ),
curve
->setRenderHint
( QwtPlotItem::RenderAntialiased,
true );
curve->setSymbol( symbol );
curve->setSamples( points );
curve->attach( &plot );
plot.resize( 600, 400 );
plot.show();
return a.exec();
}
#include <QApplication>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_grid.h>
#include <qwt_symbol.h>
#include <qwt_legend.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QwtPlot plot;
plot.setTitle( "Plot Demo" );
plot.setCanvasBackground( Qt::white );
plot.setAxisScale( QwtPlot::yLeft, 0.0, 10.0);
plot.insertLegend( new QwtLegend() );
QwtPlotGrid *grid = new QwtPlotGrid();
grid->attach( &plot );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( "Pixel Count" );
curve->setPen( Qt::blue, 4 ),
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
curve->setSymbol( symbol );
QPolygonF points;
points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
<< QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
<< QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
curve->setSamples( points );
curve->attach( &plot );
plot.resize( 600, 400 );
plot.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Project File:
TEMPLATE = app
TARGET = IPtest
INCLUDEPATH += /Users/asnapolitano/Qt/5.8/ios/mkspecs/common/uikit .
# Input
SOURCES += plottest.cpp
# Add QWT:
QT += widgets
CONFIG += c++14
CONFIG += qwt
INCLUDEPATH += "/usr/local/qwt-6.1.3/include"
LIBS += -L/usr/local/qwt-6.1.3/lib -lqwt
TEMPLATE = app
TARGET = IPtest
INCLUDEPATH += /Users/asnapolitano/Qt/5.8/ios/mkspecs/common/uikit .
# Input
SOURCES += plottest.cpp
# Add QWT:
QT += widgets
CONFIG += c++14
CONFIG += qwt
INCLUDEPATH += "/usr/local/qwt-6.1.3/include"
LIBS += -L/usr/local/qwt-6.1.3/lib -lqwt
To copy to clipboard, switch view to plain text mode
When I ran make on the project, I get the following error: symbol(s) not found for architecture x86_64.
A segment of the compilation output suggests that the qwt classes are not being detected:
Compilation Segment:
Undefined symbols for architecture x86_64:
"QwtPlotGrid::QwtPlotGrid()", referenced from:
_main in plottest.o
"QwtPlotItem::setRenderHint(QwtPlotItem::RenderHint, bool)", referenced from:
_main in plottest.o
"QwtPlotItem::attach(QwtPlot*)", referenced from:
_main in plottest.o
"QwtPlotItem::setTitle(QString const&)", referenced from:
_main in plottest.o
"QwtPlotCurve::setSamples(QVector<QPointF> const&)", referenced from:
_main in plottest.o
"QwtPlotCurve::setPen(QColor const&, double, Qt::PenStyle)", referenced from:
_main in plottest.o
"QwtPlotCurve::setSymbol(QwtSymbol*)", referenced from:
_main in plottest.o
"QwtPlotCurve::QwtPlotCurve(QString const&)", referenced from:
_main in plottest.o
"QwtPlot::insertLegend(QwtAbstractLegend*, QwtPlot::LegendPosition, double)", referenced from:
_main in plottest.o
"QwtPlot::setAxisScale(int, double, double, double)", referenced from:
_main in plottest.o
"QwtPlot::setCanvasBackground(QBrush const&)", referenced from:
_main in plottest.o
"QwtPlot::setTitle(QString const&)", referenced from:
_main in plottest.o
"QwtPlot::QwtPlot(QWidget*)", referenced from:
_main in plottest.o
"QwtPlot::~QwtPlot()", referenced from:
_main in plottest.o
"QwtLegend::QwtLegend(QWidget*)", referenced from:
_main in plottest.o
"QwtSymbol::QwtSymbol(QwtSymbol::Style, QBrush const&, QPen const&, QSize const&)", referenced from:
_main in plottest.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [IPtest.app/Contents/MacOS/IPtest] Error 1
10:49:44: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project IPtest (kit: Desktop Qt 5.8.0 clang 64bit)
When executing step "Make"
Undefined symbols for architecture x86_64:
"QwtPlotGrid::QwtPlotGrid()", referenced from:
_main in plottest.o
"QwtPlotItem::setRenderHint(QwtPlotItem::RenderHint, bool)", referenced from:
_main in plottest.o
"QwtPlotItem::attach(QwtPlot*)", referenced from:
_main in plottest.o
"QwtPlotItem::setTitle(QString const&)", referenced from:
_main in plottest.o
"QwtPlotCurve::setSamples(QVector<QPointF> const&)", referenced from:
_main in plottest.o
"QwtPlotCurve::setPen(QColor const&, double, Qt::PenStyle)", referenced from:
_main in plottest.o
"QwtPlotCurve::setSymbol(QwtSymbol*)", referenced from:
_main in plottest.o
"QwtPlotCurve::QwtPlotCurve(QString const&)", referenced from:
_main in plottest.o
"QwtPlot::insertLegend(QwtAbstractLegend*, QwtPlot::LegendPosition, double)", referenced from:
_main in plottest.o
"QwtPlot::setAxisScale(int, double, double, double)", referenced from:
_main in plottest.o
"QwtPlot::setCanvasBackground(QBrush const&)", referenced from:
_main in plottest.o
"QwtPlot::setTitle(QString const&)", referenced from:
_main in plottest.o
"QwtPlot::QwtPlot(QWidget*)", referenced from:
_main in plottest.o
"QwtPlot::~QwtPlot()", referenced from:
_main in plottest.o
"QwtLegend::QwtLegend(QWidget*)", referenced from:
_main in plottest.o
"QwtSymbol::QwtSymbol(QwtSymbol::Style, QBrush const&, QPen const&, QSize const&)", referenced from:
_main in plottest.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [IPtest.app/Contents/MacOS/IPtest] Error 1
10:49:44: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project IPtest (kit: Desktop Qt 5.8.0 clang 64bit)
When executing step "Make"
To copy to clipboard, switch view to plain text mode
I have no idea where to go from here. Any help will be greatly appreciated.
Many Thanks,
Anderson
Bookmarks