Ubuntu-G++ internal compiler error

g++ 报错:

1
2
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report

主要原因大体上是因为内存不足, 有点坑, 临时使用交换分区来解决

1
2
3
sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile

完成后,释放临时交换分区

1
2
sudo swapoff /swapfile
sudo rm /swapfile