使用
gcc -m32 myprog.c
应该在 32 位版本中编译文件 myprog.c
。
很遗憾,我收到了这个错误:
In file included from /usr/include/stdio.h:27:0,
from myprog.c:1:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory
#include <sys/cdefs.h>
我该如何解决这个问题?
如果我不使用 -m32
它可以工作,但使用 64 位指令。
最佳答案
要在 64 位 Linux 版本上编译 32 位二进制文件,您必须安装 libx32gcc
开发包和 32 位 GNU C 库
试试这个
sudo apt-get install libx32gcc-4.8-dev
和
sudo apt-get install libc6-dev-i386
https://stackoverflow.com/questions/23498237/