PDA

View Full Version : QWT Error: Symbol(s) not found for architecture x86_64



asnapolitano
1st February 2017, 18:13
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[])
{
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();
}


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

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"

I have no idea where to go from here. Any help will be greatly appreciated.

Many Thanks,
Anderson

d_stranz
1st February 2017, 19:00
Looks like you haven't installed / built a 64-bit version of Qwt.

asnapolitano
1st February 2017, 19:30
Thank you d_straz, and sorry about my original post's format. Will definitely make sure to incorporate CODE tags in my future posts. Anyways, I think I have installed a 64 bit version of qwt downloaded from the page: https://sourceforge.net/projects/qwt/files/qwt/6.1.3/. Is there any other way to make sure qwt was not installed properly?

d_stranz
2nd February 2017, 01:18
"Installed"? It's a source code tar file. Did you compile it the library? And is it in the location pointed to by your -L path? And is it named "qwt.a" or "qwt.so"?