Xcode 5.0.1,Mac OS 10.9,試圖使用Qt-Creator 3.0 beta。強制Qt「Hello World」應用程序構建32位 - 比看起來更難
我需要在32位第三方庫中使用Qt 5.2,所以我希望Qt和我的應用程序都是32位。是的,我知道這是2013年......但現在我無法選擇此事。
我用以下做了Qt 5.2(beta),做了「make」和「make install」。一切都好。
./configure -debug-and-release -commercial -confirm-license -nomake examples -platform macx-clang-32 -arch x86 -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-symbian -no-sql-symsql -no-sql-tds -prefix ~/dev/qt5
現在我想通過構建一個簡單的「Hello World」應用程序來測試Qt 5.2。但即使強硬我的Qt是爲32位構建的,即使設置了Qt版本和工具包,並且我正在使用「Clang(/ usr/bin中的x86 32位)作爲我的編譯器,我得到的鏈接錯誤我的「Hello World」應用正在建造的x86_64的
首先我得到警告:
"...QtGui.framework/QtGui, file was built for i386 which is not the architecture being linked (x86_64)... QtWidgets.framework/QtWidgets, file was built for i386 which is not the architecture being linked (x86_64)...... etc"
然後,我發現了自己的錯誤:
Undefined symbols for architecture x86_64:
"qt_assert(char const*, char const*, int)", referenced from:
QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator->() const in moc_mainwindow.o
"QArrayData::deallocate(QArrayData*, unsigned long, unsigned long)", referenced from:
QTypedArrayData<unsigned short>::deallocate(QArrayData*) in mainwindow.o
"QStatusBar::QStatusBar(QWidget*)", referenced from:
Ui_MainWindow::setupUi(QMainWindow*) in mainwindow.o
"QMainWindow::addToolBar(QToolBar*)", referenced from: ..... etc
我嘗試添加該到我的* .Pro文件中:
CONFIG += qt x86
CONFIG -= x86_64
但它仍然試圖構建X86_64。
如何強制我的hello-world應用程序構建32位,並與我構建的32位Qt框架兼容?
謝謝。
建立32細請嘗試使用一個簡單的程序改爲qmake。如果可行,那麼XCode IDE集成就存在問題。 –
我沒有使用Xcode IDE。我正在使用Qt Creator 3 – JasonGenX
好的,在這種情況下,檢查生成的Makefile。在'CFLAGS','CXXFLAGS'和'LFLAGS'中應該有'-arch i386'。如果沒有,請手動插入並查看是否修復它。如果是的話,這可能是一個錯誤。也許它沒有選擇正確的mkspec。試着用'qmake -spec macx-clang-32'強制它。 –