OSX 10.5.8上的Qt4.8 + CMake 2.8.5无法链接

时间:2012-03-29 07:50:33

标签: macos qt linker cmake osx-leopard

我在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编译的每个项目都会发生这种情况。 知道发生了什么事吗?

1 个答案:

答案 0 :(得分:1)

检查i386x86_64)正在使用的体系结构(cmakeCMAKE_OSX_ARCHITECTURES)。尝试向cmake建议架构:

cmake -DCMAKE_OSX_ARCHITECTURES=x86_64