我正在尝试在我的mavericks机器上编译Qt应用程序但是在下面得到编译错误。
我已通过设置QMake变量
将部署目标设置为10.9QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
这还没有解决问题。我怀疑Qt正在使用错误的OSX框架进行编译:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/的 MacOSX10.8.sdk
什么时候应该使用
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/的 MacOSX10.9.sdk
有没有人遇到这样的问题并找到了解决方案?
编译输出:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.9 -o qt-rodbot-ip.app/Contents/MacOS/qt-rodbot-ip main.o mainwindow.o videoviewer.o MatToQImage.o ipunitcontainer.o smoothingdialog.o unitlist.o units.o thresholddialog.o adaptivethresholddialog.o cannydialog.o contoursdialog.o processing.o capture.o chainwindow.o chainviewer.o morphologydialog.o sobeldialog.o moc_mainwindow.o moc_videoviewer.o moc_ipunitcontainer.o moc_smoothingdialog.o moc_unitlist.o moc_thresholddialog.o moc_adaptivethresholddialog.o moc_cannydialog.o moc_contoursdialog.o moc_processing.o moc_capture.o moc_chainwindow.o moc_chainviewer.o moc_morphologydialog.o moc_sobeldialog.o -F/Applications/Qt/5.2.1/clang_64/lib -L/usr/local/lib/ -lIPChain /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_calib3d.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_contrib.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_core.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_features2d.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_flann.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_gpu.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_highgui.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_imgproc.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_legacy.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_ml.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_nonfree.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_objdetect.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_ocl.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_photo.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_stitching.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_superres.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_ts.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_video.dylib /usr/local/Cellar/opencv/2.4.6.1/lib/libopencv_videostab.dylib -framework QtWidgets -framework QtGui -framework QtCore -framework OpenGL -framework AGL
Undefined symbols for architecture x86_64:
"boost::system::system_category()", referenced from:
___cxx_global_var_init2 in main.o
___cxx_global_var_init2 in mainwindow.o
boost::thread_exception::thread_exception(int, char const*) in mainwindow.o
___cxx_global_var_init2 in videoviewer.o
___cxx_global_var_init6 in ipunitcontainer.o
___cxx_global_var_init6 in smoothingdialog.o
___cxx_global_var_init6 in unitlist.o
...
"boost::system::generic_category()", referenced from:
___cxx_global_var_init in main.o
___cxx_global_var_init1 in main.o
___cxx_global_var_init in mainwindow.o
___cxx_global_var_init1 in mainwindow.o
___cxx_global_var_init in videoviewer.o
___cxx_global_var_init1 in videoviewer.o
___cxx_global_var_init in ipunitcontainer.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: *** [qt-rodbot-ip.app/Contents/MacOS/qt-rodbot-ip] Error 1
11:05:13: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project qt-rodbot-ip (kit: Desktop Qt 5.2.1 clang 64bit)
When executing step 'Make'
11:05:13: Elapsed time: 00:02.
答案 0 :(得分:1)
你用qt5配置了什么? 您可以传递配置标志 -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk 。 这会将sdk设置为macosx 10.9。 从我看到的这与升压系统库有关。 我想你正在使用一个boost库。只需链接Boost.System,它应该在/ opt / local / lib / libboost_system中。