我用 WinDBus 在 Windows 上构建了 Qt。Qt 本身构建正常,但 QDbus 示例构建失败并显示消息
moc_car_adaptor_p.obj : error LNK2001: unresolved external
symbol "public: static struct QMetaObject const
QDBusAbstractAdaptor::staticMetaObject"
(?staticMetaObject@QDBusAbstractAdaptor@@2UQMetaObject@@B)
文件夹E:\qt\4.6.4\msvc2008\lib
包含 QtDBus4.dll QtDBus4.lib QtDBusd4.dll 和 QtDBusd4.lib。全部包含'staticMetaObject@QDBusAbstractAdaptor@@2UQMetaObject@@B'
字符串。
如何解决?
事先感谢,伊利亚。
UPD: 所有 .PRO 文件都来自 DBus 示例,我没有更改任何内容。例如:
######################################################################
# Automatically generated by qmake (2.01a) Mon Aug 28 19:50:14 2006
######################################################################
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
CONFIG += qdbus
# Input
# DBUS_ADAPTORS += car.xml
HEADERS += car.h car_adaptor_p.h
SOURCES += car.cpp main.cpp car_adaptor.cpp
# install
target.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar/car
sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro *.xml
sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar/car
INSTALLS += target sources
symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
UPD2:
QtCreator 生成的命令行:
... moc.exe and cl.exe calls...
cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -GR -EHsc -W3 -w34100 -w34189
-DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB
-DQT_THREAD_SUPPORT -I"..\..\..\..\msvc2008\include\QtCore" -I"..\..\..\..\msvc2008
\include\QtGui" -I"..\..\..\..\msvc2008\include" -I"..\..\..\..\msvc2008\include
\QtDBus" -I"..\car" -I"debug" -I"..\..\..\..\msvc2008\include\ActiveQt" -I"."
-I"..\..\..\..\msvc2008\mkspecs\win32-msvc2008"
-Fodebug\ @C:\DOCUME~1\resu\LOCALS~1\Temp\moc_car_adaptor_p.obj.432.2453.jom
moc_car_adaptor_p.cpp
link /LIBPATH:"e:\qt\4.6.4\msvc2008\lib" /NOLOGO /DEBUG /MANIFEST
/MANIFESTFILE:"debug\car.intermediate.manifest" /SUBSYSTEM:WINDOWS
/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls'
version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*'
processorArchitecture='*'" /OUT:debug\car.exe @C:\DOCUME~1\resu\LOCALS~1
\Temp\car.exe.432.3734.jom
我构建 Qt 的选项:
configure.exe -platform win32-msvc2008 -shared -debug-and-release -dbus -dbus-linked
-qt-sql-sqlite -qt-sql-psql -no-qt3support -qt-zlib -qt-gif -qt-libpng -qt-libmng
-qt-libtiff -qt-libjpeg -openssl-linked -confirm-license -opensource -phonon -phonon-
backend -nomake demos -nomake examples OPENSSL_LIBS="-lssleay32MD -llibeay32MD"
-I "C:\OpenSSL-Win32\include" -I "C:\Progra~1\PostgreSQL\8.4\include"
-I E:\qt\4.6.4\msvc2008\src\dbus" -I E:\qt\4.6.4\msvc2008\src\dbus\dbus"
-L "C:\Progra~1\PostgreSQL\8.4\lib" -L "C:\OpenSSL-Win32\lib\VC\static"
-l ws2_32 -l gdi32 -l user32 -l crypt32 -l advapi32