我有Qt5
一个针对 Qt 库成功编译的项目,但是在针对 Qt 库进行编译时shared
出现了很多错误(大约 130 个错误):* error: multiple definition of 'XXX'
static
/usr/local/Qt-5.3.0/lib/libQt5Quick.a(qquickanimation.o): In function `_q_interpolateShortestRotation(double&, double&, double)':
qquickanimation.cpp:(.text+0x330): multiple definition of `_q_interpolateShortestRotation(double&, double&, double)'
/usr/local/Qt-5.3.0/lib/libQt5Declarative.a(qdeclarativeanimation.o):qdeclarativeanimation.cpp:(.text+0xd80): first defined here
/usr/local/Qt-5.3.0/lib/libQt5Quick.a(qquickanimation.o): In function `_q_interpolateClockwiseRotation(double&, double&, double)':
qquickanimation.cpp:(.text+0x3c0): multiple definition of `_q_interpolateClockwiseRotation(double&, double&, double)'
/usr/local/Qt-5.3.0/lib/libQt5Declarative.a(qdeclarativeanimation.o):qdeclarativeanimation.cpp:(.text+0xe10): first defined here
几乎所有成对检测到的多个定义:
- libQt5Declarative, libQt5Quick
- libQt5Declarative, libQt5Qml
我libQt5Declarative
只需要MessageDialog
在我的 qml中使用
我的.pro
文件:
QT += quick declarative widgets network xml xmlpatterns multimedia
TARGET = MyApp
TEMPLATE = app
SOURCES += ...
HEADERS += ...
OTHER_FILES += ...
RESOURCES += ...
CONFIG += static
我的问题是:
- 为什么它成功地针对共享 Qt 进行编译,但是当我针对静态 Qt 进行编译时却失败了?
- 这可以同时使用声明性模块和快速模块吗?
- 我自己编译了静态 Qt 库,也许我做错了,Qt 有官方静态库包吗?