Mac上编译C++报错
今天在使用Mac编译C++文件时,提示以下错误。
Undefined symbols for architecture x86_64:
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
void std::__1::vector<E, std::__1::allocator<E> >::__push_back_slow_path<E const>(E const&) in main-8b5a99.o
"std::terminate()", referenced from:
___clang_call_terminate in main-8b5a99.o
"operator delete(void*)", referenced from:
std::__1::__vector_base<E, std::__1::allocator<E> >::~__vector_base() in main-8b5a99.o
std::__1::__split_buffer<E, std::__1::allocator<E>&>::~__split_buffer() in main-8b5a99.o
"operator new(unsigned long)", referenced from:
std::__1::__split_buffer<E, std::__1::allocator<E>&>::__split_buffer(unsigned long, unsigned long, std::__1::allocator<E>&) in main-8b5a99.o
"___cxa_begin_catch", referenced from:
___clang_call_terminate in main-8b5a99.o
"___cxa_call_unexpected", referenced from:
_main in main-8b5a99.o
"___gxx_personality_v0", referenced from:
_main in main-8b5a99.o
___cxx_global_array_dtor in main-8b5a99.o
void std::__1::vector<E, std::__1::allocator<E> >::__push_back_slow_path<E const>(E const&) in main-8b5a99.o
Dwarf Exception Unwind Info (__eh_frame) in main-8b5a99.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code (use -v to see invocation)
通过在stackoverflow翻阅找到相应的解决办法。 发生这种状况的原因是gcc默认文件时c文件,在编译时不会链接c++标准库。我们可以通过以下方式进行指定引入c++标准库
gcc main.c -o macin -lstdc++
或者使用
g++ main.c -o main
参考链接:stackoverflow
Mac上编译C++报错的更多相关文章
- Mac下编译tesseract报错 DotProductAVX can't be used on Android
因为我的mac是64位的,所以用32位编译,执行的时候肯定会出错的. 所以应该在 arch/simddetect.cpp中把这句# define X86_BUILD 1 注释掉,就可以了. 参考 ht ...
- Mac上 intellij IDEA报错:Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk .jdk/Contents/Home/bin/java ( ) and /Library/Java/JavaVirtualMachines/jdk
解决方案: 点击IDEA菜单里的Help-Edit Custom Properties,没有这个properties文件的话,会提示创建,在里面加上 idea.no.launcher=true 说明: ...
- mac笔记本编译go-ethereum报错CoreServices/CoreServices.h' file not found
查看xcode是否安装: $ xcode-select --install xcode-select: error: command line tools are already installed, ...
- Xcode6在ios7上编译framework报错
错误描述: dyld: Symbol not found: _OBJC_CLASS_$_UIPresentationController Referenced from: /var/mobile/Ap ...
- mac上安装webpack报错解决方法Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/webpack
node-pre-gyp WARN Using needle for node-pre-gyp https download node-pre-gyp WARN Pre-built binaries ...
- Mac上编译并运行Android5.0源码
下载.配置环境.build和运行参考的都是Android Source提供的文档,包括:Initializing a Build Environment,Downloading the Source和 ...
- webpack编译sass报错找不到module /css-loader/index.js... || 安装node-sass报错
今天无论在家还是在公司,安装node-sass总是失败,或安装成功了,使用webpack编译sass报错,说找不到module,按照提示的错误我找了node_modules下的css-loader,发 ...
- 源码编译apache报错的解决方法
源码编译apache报错的解决方法 问题介绍 在源码编译安装httpd时,./configure执行无错误,到make时就报错,在网络上搜索了很多文章,很多方法如换apr-util的低版本并不能很 ...
- MAC 上编译安装nginx-rtmp-module 流媒体服务器
MAC 上编译安装nginx-rtmp-module 流媒体服务器 记录踩坑过程 下载nginx和nginx-rtmp-module wget http://nginx.org/download/ng ...
随机推荐
- int and string
int转string一.#include <sstream> int n = 0; std::stringstream ss; std::string str; ss<<n; ...
- Mysql命令show global status求根溯源
近来,发现好多公司对mysql的性能监控是通过show global status实现的,因此对于这个命令想要探究一番,看他是否是实时更新的. 在此之前,我们必须搞明白mysql对于这个命令的执行过程 ...
- mfc的OnInitDialog的返回值
以前从未注意过初始化函数的返回值,今天看到书中所述,以后可能用得上. OnInitDialog的返回值告诉windows如何处置输入焦点,如果返回 TRUE,则windows将输入焦点指派给制表键控制 ...
- CentOS 下 MySQL DateBasic 抢救
CentOS 下 MySQL DateBasic 抢救 强 Kill 数据库进程. 分析问题:确定报错内容 报错信息:The server quit without updating PID file ...
- 外接程序“VMDebugger”未能加载或者导致了异常。是否希望移除该外接程序?
收工~
- 【转】SQL删除重复数据方法,留着备用
感谢孙潇楠前辈的总结,地址http://www.cnblogs.com/sunxiaonan/archive/2009/11/24/1609439.html 例如: id name ...
- Activity四种启动模式
转载博客:http://blog.csdn.net/shinay/article/details/7898492 Activity启动方式有四种,分别是:standardsingleTopsingle ...
- .Net 转战 Android 4.4 日常笔记(8)--常见事件响应及实现方式
在Andrioid开发中,常见的事件如下 单击事件 OnClickListener 长按事件 OnLongClickListener 滑动事件 OnTouchListenner 键盘事件 OnKeyL ...
- 【原创】开源Math.NET基础数学类库使用(15)C#计算矩阵行列式
本博客所有文章分类的总目录:[总目录]本博客博文总目录-实时更新 开源Math.NET基础数学类库使用总目录:[目录]开源Math.NET基础数学类库使用总目录 上个月 ...
- 配置 DHCP 服务 - 每天5分钟玩转 OpenStack(89)
前面章节我们看到 instance 在启动过程中能够从 Neutron 的 DHCP 服务获得 IP,本节将详细讨论其内部实现机制. Neutron 提供 DHCP 服务的组件是 DHCP agent ...