I have started to learn assembly language and currently making a simple asm program to call printf function in C in stdio.h.
I am unable to link the object file properly after assembling. The problem I am facing is
undefined reference to printf
After browsing other questions with similar problems on SO, I tried
nasm -f elf -l call.lst call.asm
gcc -o call call.o
After doing this, I get the error:
i386 architecture of input file call.o is compatible with x86_64 output.
How should I properly link the file? Currently, I am doing the following :-
nasm -f elf call.asm
ld -m elf_i386 -s -o call call.o
What changes should I make to the above line ?