我在OSX Leopard
上使用Qt4.8而不是qmake
+ QtCreator
我想在OSX上使用CMake
编译一个非常简单的project了解如何做一个包。
虽然同一个项目在Linux下顺利编译和链接,但在我的OSX框下,这是我在链接阶段总是得到的错误消息:
ld warning: in /Library/Frameworks//QtGui.framework/QtGui, file is not of required architecture
ld warning: in /Library/Frameworks//QtCore.framework/QtCore, file is not of required architecture
Undefined symbols:
"QWidget::mousePressEvent(QMouseEvent*)", referenced from:
vtable for TestFormin moc_TestForm.cxx.o
"QObject::childEvent(QChildEvent*)", referenced from:
vtable for TestFormin moc_TestForm.cxx.o
"QWidget::actionEvent(QActionEvent*)", referenced from:
vtable for TestFormin moc_TestForm.cxx.o
"QCoreApplication::translate(char const*, char const*, char const*, QCoreApplication::Encoding)", referenced from:
etcetera etcetera。
对于我想用cmake编译的每个项目都会发生这种情况。 知道发生了什么事吗?
答案 0 :(得分:1)
检查i386
(x86_64
)正在使用的体系结构(cmake
,CMAKE_OSX_ARCHITECTURES
)。尝试向cmake
建议架构:
cmake -DCMAKE_OSX_ARCHITECTURES=x86_64