Abion47
22nd February 2014, 19:23
I figure this is probably a dumb question with a simple answer, but this has been driving me up the wall.
I'm trying to load an SVG image into a QGraphicsScene via a QGraphicsSvgItem (that right so far?), and every time I try to create the QGraphicsSvgItem object, I get this error:
<removed>\Projects\Qt\workspace\SvgContainer\svgcontainer.c pp:16: error: undefined reference to `_imp___ZN16QGraphicsSvgItemC1ERK7QStringP13QGraph icsItem'
I don't even understand what this is trying to tell me. Here's my code:
code.h
#ifndef SVGCONTAINER_H
#define SVGCONTAINER_H
#include <QWidget>
namespace Ui {
class SVGContainer;
}
class SVGContainer : public QWidget
{
Q_OBJECT
public:
explicit SVGContainer(QWidget *parent = 0);
~SVGContainer();
private:
Ui::SVGContainer *ui;
};
#endif // SVGCONTAINER_H
code.cpp
#include "svgcontainer.h"
#include "ui_svgcontainer.h"
#include <QtSvg/QGraphicsSvgItem>
SVGContainer::SVGContainer(QWidget *parent) :
QWidget(parent),
ui(new Ui::SVGContainer)
{
ui->setupUi(this);
QGraphicsScene *scene = new QGraphicsScene(this);
ui->graphicsView->setScene(scene);
QGraphicsSvgItem *svgItem = new QGraphicsSvgItem("assets\\outline.svg"); // <- Errors happen here
scene->addItem(svgItem);
}
SVGContainer::~SVGContainer()
{
delete ui;
}
I'm trying to load an SVG image into a QGraphicsScene via a QGraphicsSvgItem (that right so far?), and every time I try to create the QGraphicsSvgItem object, I get this error:
<removed>\Projects\Qt\workspace\SvgContainer\svgcontainer.c pp:16: error: undefined reference to `_imp___ZN16QGraphicsSvgItemC1ERK7QStringP13QGraph icsItem'
I don't even understand what this is trying to tell me. Here's my code:
code.h
#ifndef SVGCONTAINER_H
#define SVGCONTAINER_H
#include <QWidget>
namespace Ui {
class SVGContainer;
}
class SVGContainer : public QWidget
{
Q_OBJECT
public:
explicit SVGContainer(QWidget *parent = 0);
~SVGContainer();
private:
Ui::SVGContainer *ui;
};
#endif // SVGCONTAINER_H
code.cpp
#include "svgcontainer.h"
#include "ui_svgcontainer.h"
#include <QtSvg/QGraphicsSvgItem>
SVGContainer::SVGContainer(QWidget *parent) :
QWidget(parent),
ui(new Ui::SVGContainer)
{
ui->setupUi(this);
QGraphicsScene *scene = new QGraphicsScene(this);
ui->graphicsView->setScene(scene);
QGraphicsSvgItem *svgItem = new QGraphicsSvgItem("assets\\outline.svg"); // <- Errors happen here
scene->addItem(svgItem);
}
SVGContainer::~SVGContainer()
{
delete ui;
}