Including Qt Headers in a DLL

I have a DLL in which I would like to take a reference to a QObject and manipulate it without actually creating an interface. So, I turned on "Qt / qobject.h" and compiled, but the compiler (Visual Studio 2008 pro) gives me syntax errors. It does not seem to recognize the QThread object. How to use QObject in my dll? Is it possible? Should I run my program from a Qt application? I'm actually trying to set a system-wide hook and get a 3rd QWidgets application to control ... Any idea how I can use QObject in my DLL?

Here are the errors:

1>------ Build started: Project: FroggerDLL, Configuration: Debug Win32 ------
1>Compiling...
1>FTClient.cpp
1>c:\qt-win-opensource-src-4.5.2\src\corelib\kernel\qobject.h(154) : error C2059: syntax error : 'type'
1>c:\qt-win-opensource-src-4.5.2\src\corelib\kernel\qobject.h(154) : error C2238: unexpected token(s) preceding ';'
1>c:\qt-win-opensource-src-4.5.2\src\corelib\kernel\qobject.h(155) : error C2144: syntax error : 'int' should be preceded by ')'
1>c:\qt-win-opensource-src-4.5.2\src\corelib\kernel\qobject.h(155) : error C2144: syntax error : 'int' should be preceded by ';'
1>c:\qt-win-opensource-src-4.5.2\src\corelib\kernel\qobject.h(155) : error C2059: syntax error : ')'
1>c:\qt-win-opensource-src-4.5.2\src\corelib\kernel\qobject.h(155) : error C2208: 'int' : no members defined using this type
1>FroggerDLL - 6 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========

Any help would be greatly appreciated.

thanks

Dave

+3
source share
3 answers

, : Qt, , .

!

+1

154? Mine -

QThread* thread() const;

4.5.1 Linux, . , type, 204, Qt::ConnectionType.

BTW. ( incqobj.cpp)

include <QOObject>
QObject myQOject;

g++ -I/usr/lib/qt4/include -I/usr/lib/qt4/include/QtCore -c incqobj.cpp

, .

: , Windows, , Qt, . , , - , , VS , .

VS , , \E ?  [: . , /E ] , . , , ! , , , 154 QObject.

+1

QThread?

#include <QThread>

Qt , .

EDIT:

- ? , (2003 ) Qt ( , dll Qt):

QT_LARGEFILE_SUPPORT
QT_DLL
QT_GUI_LIB
QT_CORE_LIB
QT_THREAD_SUPPORT
QT_NETWORK_LIB
0
source

Source: https://habr.com/ru/post/1712711/


All Articles