Mac OS 下g++(c++)编译工具无法使用
来源:互联网 发布:网页游戏开服数据报告 编辑:程序博客网 时间:2024/06/02 04:45
最近在Mac OS上做C++ 开发,却遇到一个让人难以费解的问题。g++工具无法编译c++源码,提示找不到__debug文件(这个文件我也不知道是做什么用的,有知道的希望各位高手们能指点一下)。其实源码很简单,就是简单的Hell World。
#include<iostream>
using namespace std;
int main(){
cout << "Hello World!" << endl;
return 0;
}
kevindeMacBook-Air:namespace kevin$ g++ hello.cpp
In file included from hello.cpp:1:In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iostream:38:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ios:216:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:15:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:439:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:628:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:604:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:341:10: fatal error: '__debug' file not found
#include <__debug>
^
1 error generated.
发现上述问题后,baidu了the question,但是没有结果。然后在google上找到了一个凑效的解决方法(但作者没有说明解决的缘由)
kevindeMacBook-Air:namespace kevin$ echo '#define _LIBCPP_ASSERT(x, m) ((void)0)' | sudo tee -a /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug > /dev/nullPassword:
kevindeMacBook-Air:namespace kevin$ g++ hello.cpp
kevindeMacBook-Air:namespace kevin$ ./a.out
Hello World!
感觉作者是创建了一个__debug 文件并在其中写入了相应的内容,但是如果是这样的话,那g++工具在安装的时候就没有这个文件吗?实在不明白怎么回事。 这里只把一种解决方法贴出来,希望能帮到跟我一样的人。如果有人知道这个方法的原理,烦请告知,不胜感激
0 0
- Mac OS 下g++(c++)编译工具无法使用
- MAC OS下Qt SDK1.2安装后出现g++-4.2问题无法编译
- mac os 下 编译 objective-c
- Mac OS X 下编译使用 LAJP
- mac下使用vim gcc/g++ 编译cpp(c++)文件并运行
- 在 Mac OS X 下编译 Objective-C 运行时
- MAC OS下编译OPENGL
- Mac OS下编译ffmpeg
- Mac OS 下编译ffmpeg
- Mac OS X下使用终端编译OpenGL程序
- iOS FFmpeg 在Mac OS下的编译和使用
- Mac OS 下编译OpenCV for iOS ,android ,mac os
- mac os 下使用pomelo
- win10下使用VMware12安装MAC OS 10.12遇到的问题,无MAC OS安装选项,无法安装VMwareTools等
- mac os下使用 Docker安装oracle-xe-11g数据库
- mac os/Linux 下命令行C/C++/Java代码编译+运行方法
- mac os 下的 ftp工具
- Mac OS下的wifi配置工具
- KVC 与 KVO 理解
- 改变placeholder的颜色
- WebService学习笔记
- 类的动态加载
- 通达OA 一个正式用户被提示软件试用过期的问题处理(图文)
- Mac OS 下g++(c++)编译工具无法使用
- 栈让我用完了
- Cow Bowling(POJ-3176)
- 每个人心里都希望自己能够有所改变
- 在idea中将grails自动生成的项目部署到本地tomcat
- java @override 报错处理
- Android launchMode
- linux源码分析之字节序(5)-- swab.h
- Java利用Jackson转换json和java对象