mchome
19th August 2012, 15:11
I would like to use SVG using my QT SDK 1.2.
First of all I've compiled and run successfully the Qt standard example "SVG Generator"
When I compiled my file (whose name is CLineChart.cpp), starting with the following rows:
#include <QtGui>
#include <QApplication>
#include <QFontMetrics>
#include <QMessageBox>
#include <QSet>
#include <QSvgGenerator>
I get the following compiler error:
/Users/ceraolo/Documents/C++/TestLineChartMac-Build/../TestCLineChartMac/CLineChart.cpp:6: error: QSvgGenerator: No such file or directory
Indeed, even during the code completion, when the above line N. 6 was being written, QCreator was not able to find the header <QSvgGenerator> (that is the one used in the Qt standard example "SVG Generator") but suggested, as a replacement the foliowing header:
#include <QtSvg/QSvgGenerator>
So, I resorted to use as first rows of the file CLineChart.cpp the following ones:
#include <QtGui>
#include <QApplication>
#include <QFontMetrics>
#include <QMessageBox>
#include <QSet>
#include <QtSvg/QSvgGenerator>
I now get new error messages:
Undefined symbols for architecture x86_64:
"QSvgGenerator::QSvgGenerator()", referenced from:
CLineChart::makeSvg() in CLineChart.o
"QSvgGenerator::setFileName(QString const&)", referenced from:
CLineChart::makeSvg() in CLineChart.o
"QSvgGenerator::~QSvgGenerator()", referenced from:
CLineChart::makeSvg() in CLineChart.o
ld: symbol(s) not found for architecture x86_64
The class QSvGenerator is used in CLineChart.cpp only in the following function:
QString CLineChart::makeSvg(){
QString ret="";
QSvgGenerator generator;
QPainter *basePainter=myPainter;
generator.setFileName("plot.svg");
myPainter->begin(&generator);
plot(false,false);
myPainter=basePainter;
QMessageBox::information(this,"CLineChart","SVG drawing successfully created and saved in file ""plot.svg"".");
return ret;
}
So the problem is now that the class QSvgGenerator is not found at linking time, and the linker complains about the implicit constructor and distructor of "generator" and the request to execute its member function "setFileName".
Does anyone have any suggestions about how to solve this issue?
Thank a lot in advance.
MC
First of all I've compiled and run successfully the Qt standard example "SVG Generator"
When I compiled my file (whose name is CLineChart.cpp), starting with the following rows:
#include <QtGui>
#include <QApplication>
#include <QFontMetrics>
#include <QMessageBox>
#include <QSet>
#include <QSvgGenerator>
I get the following compiler error:
/Users/ceraolo/Documents/C++/TestLineChartMac-Build/../TestCLineChartMac/CLineChart.cpp:6: error: QSvgGenerator: No such file or directory
Indeed, even during the code completion, when the above line N. 6 was being written, QCreator was not able to find the header <QSvgGenerator> (that is the one used in the Qt standard example "SVG Generator") but suggested, as a replacement the foliowing header:
#include <QtSvg/QSvgGenerator>
So, I resorted to use as first rows of the file CLineChart.cpp the following ones:
#include <QtGui>
#include <QApplication>
#include <QFontMetrics>
#include <QMessageBox>
#include <QSet>
#include <QtSvg/QSvgGenerator>
I now get new error messages:
Undefined symbols for architecture x86_64:
"QSvgGenerator::QSvgGenerator()", referenced from:
CLineChart::makeSvg() in CLineChart.o
"QSvgGenerator::setFileName(QString const&)", referenced from:
CLineChart::makeSvg() in CLineChart.o
"QSvgGenerator::~QSvgGenerator()", referenced from:
CLineChart::makeSvg() in CLineChart.o
ld: symbol(s) not found for architecture x86_64
The class QSvGenerator is used in CLineChart.cpp only in the following function:
QString CLineChart::makeSvg(){
QString ret="";
QSvgGenerator generator;
QPainter *basePainter=myPainter;
generator.setFileName("plot.svg");
myPainter->begin(&generator);
plot(false,false);
myPainter=basePainter;
QMessageBox::information(this,"CLineChart","SVG drawing successfully created and saved in file ""plot.svg"".");
return ret;
}
So the problem is now that the class QSvgGenerator is not found at linking time, and the linker complains about the implicit constructor and distructor of "generator" and the request to execute its member function "setFileName".
Does anyone have any suggestions about how to solve this issue?
Thank a lot in advance.
MC