32位
gcc -m32 test.cpp -o test.out
链接环节可能会出错,原因是缺少对应的32位库,毕竟现在默认都是64位的系统。需要执行如下指令安装对应库
apt-get install build-essential module-assistant
apt-get install gcc-multilib g++-multilib
64位
gcc -m64 test.cpp -o test.out //OR gcc test.cpp -o test.out(一般默认是编译成64位程序的)
[参考] https://blog.csdn.net/qq512028505/article/details/78239656
网友评论