error: symbol(s) not found for architecture x86_64
2016-01-06 21:40
537 查看
更新Mac到10.9.2版本,同时更新了Xcode,这时候再用QT到时候发现调用OpenCV就出错:error: symbol(s) not found for architecture x86_64
看起来就是没有找到合适的lib文件,太坑爹了,之前还是用得好好的。
重装Xcode, 重装OpenCV,重装QT后无效。
后来千辛万苦终于找到结果了,大神在这里:
http://stackoverflow.com/questions/20342896/solved-qt5-1-qt5-2-mac-os-10-9-mavericks-xcode-5-0-2-undefined-symbols
因为OpenCV是用Xcode编译的,而新的Xcode调用的OS X 10.9,但是QT还没有更新,还是用10.6,所以编译后的OpenCV就不会被QT识别了。
解决:
更改 ../Qt5.2.0/5.2.0-rc1/clang_64/mkspecs/macx-clang/qmake.conf
文件中的
然后对QT对工程先清理,再rebuild,就可以编译了。
This issue is answered in this post
http://qt-project.org/forums/viewthread/35646/
and explained by sandy.martel
I quoted here
Qt binary distribution compile with -stdlib=libstdc++ to be compatible with 10.6, Xcode 5 on 10.9 will select -stdlib=libc++ by default (for OS X 10.7 and better only). So symbol using classes from the standard library (like std::string in this case) will not
resolve correctly at link time. This is why you’re seeing this error (Undefined symbols for architecture x86_64) . Look with which standard library opencv is built: otool -L libopencv_XXX.dylib. You’ll have to rebuild it with the right one or change Qt’s mkspec
to use the newer one.
I solve this by changing ../Qt5.2.0/5.2.0-rc1/clang_64/mkspecs/macx-clang/qmake.conf
from
to
And remember clean your project before rebuild.
http://stackoverflow.com/questions/20342896/qt5-1-qt5-2-mac-os-10-9-mavericks-xcode-5-0-2-undefined-symbols-for-archi
看起来就是没有找到合适的lib文件,太坑爹了,之前还是用得好好的。
重装Xcode, 重装OpenCV,重装QT后无效。
后来千辛万苦终于找到结果了,大神在这里:
http://stackoverflow.com/questions/20342896/solved-qt5-1-qt5-2-mac-os-10-9-mavericks-xcode-5-0-2-undefined-symbols
因为OpenCV是用Xcode编译的,而新的Xcode调用的OS X 10.9,但是QT还没有更新,还是用10.6,所以编译后的OpenCV就不会被QT识别了。
解决:
更改 ../Qt5.2.0/5.2.0-rc1/clang_64/mkspecs/macx-clang/qmake.conf
文件中的
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit;"><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent;">QMAKE_MACOSX_DEPLOYMENT_TARGET </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent;">=</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent;"> </span><span class="lit" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent; color: rgb(128, 0, 0);">10.6</span></code>改为
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit;"><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent;">QMAKE_MACOSX_DEPLOYMENT_TARGET </span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent;">=</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent;"> </span><span class="lit" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: transparent; color: rgb(128, 0, 0);">10.9</span></code>
然后对QT对工程先清理,再rebuild,就可以编译了。
Qt5.1/Qt5.2
+ Mac OS 10.9 (Mavericks) + XCode 5.0.2, Undefined symbols for architecture x86_64
This issue is answered in this posthttp://qt-project.org/forums/viewthread/35646/
and explained by sandy.martel
I quoted here
Qt binary distribution compile with -stdlib=libstdc++ to be compatible with 10.6, Xcode 5 on 10.9 will select -stdlib=libc++ by default (for OS X 10.7 and better only). So symbol using classes from the standard library (like std::string in this case) will not
resolve correctly at link time. This is why you’re seeing this error (Undefined symbols for architecture x86_64) . Look with which standard library opencv is built: otool -L libopencv_XXX.dylib. You’ll have to rebuild it with the right one or change Qt’s mkspec
to use the newer one.
I solve this by changing ../Qt5.2.0/5.2.0-rc1/clang_64/mkspecs/macx-clang/qmake.conf
from
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
to
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
And remember clean your project before rebuild.
http://stackoverflow.com/questions/20342896/qt5-1-qt5-2-mac-os-10-9-mavericks-xcode-5-0-2-undefined-symbols-for-archi
相关文章推荐
- 课题:监控视频内的人数统计
- 怎么为WebStorm更换主题 修改字体样式
- makefile--变量的使用(二)
- “顶层const”和“底层const”的思考
- 找回Reshaprer的Alt+Enter快捷键的方法
- 前端开发工具sumlime
- 1010. 一元多项式求导 (25)
- nginx 1.9 支持http2 协议
- 基于iOS,Android的服务器证书失效检测
- RAM
- 构建高可用Linux服务器二
- 数据库表空间
- Linux信号入门详解
- android之旅24 多媒体编程:音乐、视频、拍照、视频
- 实例10:带选择头像的用户注册页面
- 学习4
- RESTful架构2--架构详解
- Quartz Scheduler(2.2.1) - Usage of CronTriggers
- 字典树两种写法....
- 13天