我在“/Users/me/lib/qt-5.1.1/”中安装了 Qt 5.1.1。在“/Users/me/lib/qt-5.1.1/5.1.1/clang_64/lib”下,除了构建一个简单的应用程序之外,还有所有框架:
#include <QtGui>
#include <QMainWindow>
#include <qapplication.h>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QMainWindow mw;
mw.show();
return app.exec();
}
在规范步骤之后:
$qmake -project
$qmake
$make
链接器无法链接:
Undefined symbols for architecture x86_64:
"QMainWindow::QMainWindow(QWidget*, QFlags<Qt::WindowType>)", referenced from:
_main in main.o
"QMainWindow::~QMainWindow()", referenced from:
_main in main.o
"QApplication::exec()", referenced from:
_main in main.o
"QApplication::QApplication(int&, char**, int)", referenced from:
_main in main.o
"QApplication::~QApplication()", referenced from:
_main in main.o
"QWidget::show()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [test.app/Contents/MacOS/test] Error 1
我添加到链接器标志
-F/Users/me/lib/qt-5.1.1/5.1.1/clang_64/lib -framework QtGui -framework QtCore
铿锵版本是:
$clang --version
Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
任何的想法?