/usr/bin/ld: i386:x86-64 architecture of input file `command.o' is incompatible with i386 output

/usr/bin/ld: i386:x86-64 architecture of input file `command.o' is incompatible with i386 output

出现这种警告的时候的时候,运行程序老是段错误,要加-m32,就好了。

gcc -m32 -o usehello_static usehello.c libhello.a

原因引用的库是 32位的,我是用的64位的系统

参考:https://github.com/Liutos/LiutCL/issues/6 

原文地址:https://www.cnblogs.com/lpshou/p/3166419.html