1.问题描述
在mac 下编译c++程序会报如下错误:
MacBook-Pro:~/Documents/data_structure/Sort/Merge $g++ merge_sort.cpp
In file included from merge_sort.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
found
#include <__debug>
^
1 error generated.
2.解决方法
echo '#define _LIBCPP_ASSERT(x, m) ((void)0)' | sudo tee -a /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug > /dev/null
3.reference
https://github.com/google/protobuf/issues/74
http://sleepythread.blogspot.com/2013/11/installing-protoc-25x-compiler-google.html
https://github.com/JuliaLang/julia/issues/10822
http://stackoverflow.com/questions/29529455/missing-c-header-debug-after-updating-osx-command-line-tools-6-3
http://www.cnblogs.com/yanghuahui/p/4448728.html