mac上使用g++编译出错“Undefined symbols for architecture x86_64:” 错误解决办法
2014-09-23 18:54
645 查看
搞了一下午,终于找到答案了!!再Mac上使用自带的g++编译使用opencv编写的图像代码,在使用图像数据结构时,使用IplImage和CvMat数据类型进行简单的加载、显示图像和两种数据的相互转换都没有错误,但只要使用Mat数据结构就出现下面的错误:
Undefined symbols for architecture x86_64:\
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:\
_main in main.o\
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:\
_main in main.o\
"std::terminate()", referenced from:\
___clang_call_terminate in main.o\
"___cxa_begin_catch", referenced from:\
___clang_call_terminate in main.o\
"___gxx_personality_v0", referenced from:\
_main in main.o\
Dwarf Exception Unwind Info (__eh_frame) 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: *** [main] Error 1\
想了很多办法,终于看到有人提示:编译选项添加-lstdc++,即使用标准C++库,问题解决!
-------------------------------------------------------------------------------------------------------------------------
机器视觉群:454254462 ,欢迎加入,进行算法研究!
AR/VR群:244751474 ,欢迎加入,进行项目讨论!
Undefined symbols for architecture x86_64:\
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:\
_main in main.o\
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:\
_main in main.o\
"std::terminate()", referenced from:\
___clang_call_terminate in main.o\
"___cxa_begin_catch", referenced from:\
___clang_call_terminate in main.o\
"___gxx_personality_v0", referenced from:\
_main in main.o\
Dwarf Exception Unwind Info (__eh_frame) 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: *** [main] Error 1\
想了很多办法,终于看到有人提示:编译选项添加-lstdc++,即使用标准C++库,问题解决!
-------------------------------------------------------------------------------------------------------------------------
机器视觉群:454254462 ,欢迎加入,进行算法研究!
AR/VR群:244751474 ,欢迎加入,进行项目讨论!
相关文章推荐
- 用xcode6.3编译早期工程时出现Undefined symbols for architecture x86_64错误的解决办法(转)
- 一分钟解决Xcode的Undefined symbols for architecture x86_64编译错误
- Qt5.2.1 Mac 10.9 Undefined symbols for architecture x86_64 错误解决
- Mac下Clion编译错误:Undefined symbols for architecture x86_64
- Mac 下cocos2dx 出现Undefined symbols for architecture x86_64 解决方法
- Xcode技巧:项目导入外部文件后编译运行出现Undefined symbols for architecture x86_64错误
- iOS编译错误#ld: warning: ignoring file# 之 Undefined symbols for architecture x86_64 - ld: symbol(s) not found for architecture x86_64
- xcode 4 导入Lib,Framework的方法,和Undefined symbols for architecture x86_64:的一种解决办法
- osX下编译c++程序出现Undefined symbols for architecture x86_64的原因及解决
- xcode 4 导入Lib,Framework的方法,和Undefined symbols for architecture x86_64:的一种解决办法
- 如何解决duplicate symbols for architecture x86_64编译错误
- Xcode技巧:项目导入外部文件后编译运行出现Undefined symbols for architecture x86_64错误
- Xcode技巧:项目导入外部文件后编译运行出现Undefined symbols for architecture x86_64错误
- Undefined symbols for architecture x86_64:的一种解决办法
- Mac下C++编译时报错“Undefined symbols for architecture x86_64”
- xcode 4 导入Lib,Framework的方法,和Undefined symbols for architecture x86_64:的一种解决办法
- 使用百度地图2.9sdk Undefined symbols for architecture x86_64: "_NSBackgroundColorAttributeName", 问题解决方法
- 编译CImg时,Undefined symbols for architecture x86_64的问题解决
- 项目中某些静态库缺少,或者编译环境的问题造成的相关编译错误(Undefined symbols for architecture x86_64:)
- Undefined symbols for architecture x86_64错误