PDA

View Full Version : Qt and Excel



eltecprogetti
12th March 2012, 16:54
Hi,

I read this thread:
http://www.qtcentre.org/threads/8276-Excel-using-Qt

and I read also this page:

http://qt-project.org/forums/viewthread/1871


In my application I wrote only this line:

#include <QAxObject>

......
.....

QAxObject * excel = new QAxObject( "Excel.Application", 0 );

and I have 3 errors:

1) C:\Documents and Settings\Giuseppe\Applicativi QT\Excel-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2008__Qt_SDK__Debug\..\Excel\mainwindow.cpp:2 4: warning: C4189: 'excel' : local variable is initialized but not reference

2) mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall QAxObject::QAxObject(class QString const &,class QObject *)" (??0QAxObject@@QAE@ABVQString@@PAVQObject@@@Z) referenced in function "private: void __thiscall MainWindow::on_pushButton_clicked(void)" (?on_pushButton_clicked@MainWindow@@AAEXXZ)

3) debug\Excel.exe:-1: error: LNK1120: 1 unresolved externals

WHY ??????????????!!!!!!!!!!!!!

wysota
12th March 2012, 22:13
Did you link your application against ActiveQt module?

eltecprogetti
13th March 2012, 08:33
No, I don't know this ActiveQt module......

Where can I found it, and how can I link this module in my application?

Thanks.

wysota
13th March 2012, 08:39
Add the following to your project file:

QT += activeqt

eltecprogetti
13th March 2012, 08:54
I add the command:

QT += core gui
QT += xml
QT += activeqt

The result is the same, no difference.....

I must to include some library in my MainWindow.cpp?

wysota
13th March 2012, 09:32
Do you have activeqt.lib (or similar) in your Qt's installation lib folder?

eltecprogetti
13th March 2012, 10:40
No, I haven't. Do you know which one to use?

wysota
13th March 2012, 12:04
There should be qaxcontainer.lib in QTDIR/lib

Try adding QT += qaxcontainer (and not QT += activeqt as I previously stated). Better yet just read the docs for ActiveQt, the instructiions are pretty straightforward.