Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Having trouble to compile a 32 bits program on fedora 21(64bits)

I'm having an assembly course in my university. Our prof ask us the download some code from http://www.drpaulcarter.com/pcasm/index.php (example code for Linux, at the bottom of the page )

Since it's 32 bits program so i add -m32 after gcc and g++

but i still have trouble compiling the program. Can anyone pls help me ? thank you in advance

gcc -c  driver.c
driver.c:3:1: warning: ‘cdecl’ attribute ignored [-Wattributes]
 int PRE_CDECL asm_main( void ) POST_CDECL;
 ^
nasm -f elf prime.asm
nasm -f elf -d ELF_TYPE asm_io.asm
gcc  -oprime driver.o prime.o asm_io.o
/usr/bin/ld: i386 architecture of input file `prime.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `asm_io.o' is incompatible with i386:x86-64 output
collect2: error: ld returned 1 exit status
Makefile:28: recipe for target 'prime' failed
make: *** [prime] Error 1