PDA

View Full Version : problem when using QSystemTrayIcon



thrantir
20th July 2007, 17:49
Dear all

I'm trying to add a system tray icon to my application.
The target system is Windows XP (sp2) and the QT version is 4.2.2

I have added a QSystemTrayIcon to my main class, a menù and some actions, following this tutorial (http://doc.trolltech.com/4.2/desktop-systray-window-cpp.html). The code compiles, the problem is during linking time. There are some symbols my Visual Studio (7.1) cannot find. The errors are are:

error LNK2001: unresolved external symbol "protected: virtual bool __thiscall QSystemTrayIcon::event(class QEvent *)" (?event@QSystemTrayIcon@@MAE_NPAVQEvent@@@Z)
error LNK2001: unresolved external symbol "public: virtual int __thiscall QSystemTrayIcon::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QSystemTrayIcon@@UAEHW4Call@QMetaObj ect@@HPAPAX@Z)
error LNK2001: unresolved external symbol "public: virtual void * __thiscall QSystemTrayIcon::qt_metacast(char const *)" (?qt_metacast@QSystemTrayIcon@@UAEPAXPBD@Z)
error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QSystemTrayIcon::metaObject(void)const " (?metaObject@QSystemTrayIcon@@UBEPBUQMetaObject@@X Z)
error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QSystemTrayIcon::setContextMenu(class QMenu *)" (__imp_?setContextMenu@QSystemTrayIcon@@QAEXPAVQMe nu@@@Z)
error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QSystemTrayIcon::QSystemTrayIcon(class QObject *)" (__imp_??0QSystemTrayIcon@@QAE@PAVQObject@@@Z)
error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QSystemTrayIcon::~QSystemTrayIcon(void)" (__imp_??1QSystemTrayIcon@@UAE@XZ) referenced in function "public: virtual void * __thiscall QSystemTrayIcon::`scalar deleting destructor'(unsigned int)" (??_GQSystemTrayIcon@@UAEPAXI@Z)



Could someone help me to understand how can I solve this issue?

Thanks in advance

jpn
20th July 2007, 17:59
Are you 100% sure Visual Studio is not linking against older version of Qt? Are you using commercial or opensource version of Qt?

thrantir
21st July 2007, 12:17
I'm using the commercial version... I thought maybe I'm linking an old qt version, as i passed several version on my machine... how can i find which version of qt visul studio is link?

Many thanks :)

marcel
21st July 2007, 12:25
In the Tools menu, choose Options/Qt/Builds.
You can select there between the available versions.

But you also have to make sure the environment variables are set correctly. Most important are QTDIR and PATH.
The latter should be PATH=%QTDIR%\bin;%PATH%.

Regards

jpn
21st July 2007, 13:27
There is also a shortcut called "Change Qt version" in the context menu of the solution (in Solution Explorer).

thrantir
23rd July 2007, 11:14
great!!!

now my program links and run, many many thanks :)