C++: internal compiler error: Killed (program cc1plus) [How to Solve]

This is an error reported when compiling opencv on the development board, which is mainly caused by insufficient memory during the compilation process

Solution:

The size of #count is the size of the added swap space, 64M is the block size, so the space size is bs*count=1024MB
sudo dd if=/dev/zero of=/swapfile bs=64M count=16
# format the space into swap format just now
sudo mkswap /swapfile
#Change directory permissions, if you don't, you will get "swapon: /swapfile: insecure permissions 0644, 0600 suggested." error on next boot
sudo chmod 0600 /swapfile 
#Use the swap space you just created
sudo swapon /swapfile

The temporary space can be closed when the work is finished

sudo swapoff -a
#Detailed usage can be: swapoff --help
#To view current memory usage.free -m

Similar Posts: