ShamusVW
19th April 2010, 15:10
I have found some code that I am playing with to learn how to export data to Excel
QAxObject* excel = new QAxObject("Excel.Application", 0);
QAxObject* app = excel->querySubObject("Application()");
QAxObject* wbks = excel->querySubObject("Workbooks()");
QAxObject* wb = wbks->querySubObject("Add()");
QAxObject* ws = wb->querySubObject("Worksheets(int)", 1 );
//Show Excel
app->setProperty("Visible", true );
However, I get the following errors:
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxObject::QAxObject(QString const&, QObject*)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
I have #include <QAxObject> at the beginning of the code.
Can someone tell me where I am going wrong?
Thanks.
QAxObject* excel = new QAxObject("Excel.Application", 0);
QAxObject* app = excel->querySubObject("Application()");
QAxObject* wbks = excel->querySubObject("Workbooks()");
QAxObject* wb = wbks->querySubObject("Add()");
QAxObject* ws = wb->querySubObject("Worksheets(int)", 1 );
//Show Excel
app->setProperty("Visible", true );
However, I get the following errors:
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxObject::QAxObject(QString const&, QObject*)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
release/mainwindow.o:mainwindow.cpp::: error: undefined reference to `QAxBase::querySubObject(char const*, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&, QVariant const&)'
I have #include <QAxObject> at the beginning of the code.
Can someone tell me where I am going wrong?
Thanks.