Centos 下 C++ 17 编程环境配置

安装 gcc 9.0及以上版本

http://gcc.gnu.org/mirrors.htm

wget https://mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-9.5.0/gcc-9.5.0.tar.gz

tar zxf gcc-9.5.0.tar.gz

cd gcc-9.5.0

mkdir build

cd build

../configure --enable-languages=c,c++ --disable-multilib

  如果上一步出错 configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.

  那么进行 ./contrib/download_prerequisites 这一步

make j4  //在编译之前需要安装 gcc 以及 g++ yum install gcc ; yum install gcc-c++

make   //默认安装在  /usr/local

export PATH=/usr/local/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH

 Install latest GCC from source on Centos Linux release | by Bipul Kuri | Medium

测试

这里使用 C++ 17 特性 <filesystem> 简单获取一下当前路径

#include <filesystem> //for curr path
auto currpth = std::filesystem::current_path();
myprintf("currpath :%s\n", currpth.c_str());

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值