I have found some code that I am playing with to learn how to export data to Excel

Qt Code:
  1. QAxObject* excel = new QAxObject("Excel.Application", 0);
  2. QAxObject* app = excel->querySubObject("Application()");
  3. QAxObject* wbks = excel->querySubObject("Workbooks()");
  4. QAxObject* wb = wbks->querySubObject("Add()");
  5. QAxObject* ws = wb->querySubObject("Worksheets(int)", 1 );
  6.  
  7. //Show Excel
  8. app->setProperty("Visible", true );
To copy to clipboard, switch view to plain text mode 

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.