MAC编译OpenJDK8:iostream file not found(独家解决办法)

  吾第一次编译没这个错误,后来又出现了。网上的办法都没用。只好自己解决。仔细一想,这个错误其实很简单啊,就是找不到文件。只要找到就行了。顺着这个思路,吾找到解决办法。

  • 安装头文件

https://blog.csdn.net/quantum7/article/details/108466760

  • 查找iostream的位置

起始位置应该是:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++

  • 设置环境变量
NEW_INCLUDE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
export.  CFLAGS=-I$NEW_INCLUDE
export CXXFLAGS=-I$NEW_INCLUDE

再次编译,通过。

猜你喜欢

转载自blog.csdn.net/quantum7/article/details/108486354