PDA

View Full Version : Linking Qt in a dynamic library



dave_mm0
18th July 2009, 14:47
Hi, I have a dynamic library that works fine, and I would like to use a QObject in it. After including the "qobject.h" header, I compile adn evrything is fine. But when I try declaring a QObject, the compiler always gives me a "identifier not found" error. I tried foward eclaration of the QObject class, it did not help. It's weird because visual studio's intellisense is working when I use Qt in my dll (ex.: when i declare a QObject, visual sdio shows me the functions available to my QObject). Is there anything special I have to do to use Qt in a dynamic library? Do I have to compile it with qmake now that I'm using a QObject?

thanks for the help

Dave

freezeblue
18th July 2009, 15:45
you should use


#include <QObject>

dave_mm0
18th July 2009, 15:51
you should use


#include <QObject>

thx, but I tried, gives me the same errors...


EDIT: the problems seems only to occur after I include stdafx.h. If I try to include the Qt headers after Stdafx.h, my library fails to compile, giving me syntax errors. If I use a Qt reference before including Stdafx.h, it compiles and runs fine.

freezeblue
18th July 2009, 16:07
Can you post the full compile output messages?

dave_mm0
18th July 2009, 16:28
Can you post the full compile output messages?

sure, here it is


1>c:\users\dave\documents\visual studio 2008\projects\frogger\froggerdll\ftclient.cpp(47) : error C2653: 'QWidget' : is not a class or namespace name
1>c:\users\dave\documents\visual studio 2008\projects\frogger\froggerdll\ftclient.cpp(47) : error C3861: 'find': identifier not found

the line in question is QWidget::find(hwnd);
and I am including <QWidget>