C/C++编译时报错 fatal error: stdatomic.h: No such file or directory
在Linux下,使用gcc编译源码时报错
fatal error: stdatomic.h: No such file or directory
#include <stdatomic.h>
^
compilation terminated.
原因是gcc 4.8版本过低,需要gcc更高的版本,如何安全升级gcc版本呢?
可通过centos-release-scl源安装devtoolset包
yum install centos-release-scl
yum install devtoolset-8
或自行添加源来安装(我这里以CentOS7为例)
vi /etc/yum.repos.d/CentOS-SCLo-scl.repo
[centos-sclo-sclo]
name