【发布时间】:2009-07-15 19:38:32
【问题描述】:
我有一个 DLL,我想引用 QObject 并对其进行操作,而无需实际创建接口。因此,我包含了“Qt/qobject.h”并进行了编译,但编译器(Visual Studio 2008 pro)给了我语法错误。看起来它无法识别 QThread 对象。如何在我的 dll 中使用 QObject?这甚至可能吗?我必须从 Qt 应用程序启动我的程序吗?我实际上是在尝试设置一个系统范围的钩子并让第三个应用程序 QWidgets 来操作......知道如何在我的 dll 中使用 QObject 吗?
以下是错误:
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 ==========
任何帮助将不胜感激,
谢谢
戴夫
【问题讨论】:
-
我只是做了同样的事情 Troubadour 做的,但在 VS2010 中,它也工作得很好。发生了一些可疑的事情......
标签: qt dll visual-c++