lundi 13 février 2017

How to link a NASM code and GCC in Mac OS X?

Vote count: 0

I'm unable to link my code with gcc, check this code:

extern printf
global main
section .data
  mensaje: db "Hola mundo!", 10,0
section .text
  push mensaje
  call printf
  add esp, 4

The output I get is:

Undefined symbols for architecture i386: "_main", referenced from: implicit entry/start for main executable "printf", referenced from: main in holamundo.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am using this command:

nasm -f macho32 holamundo.asm

and gcc command(I get the error, here):

gcc -m32 holamundo.o -o holamundo

Thanks in advance, my english is ever bad.

asked 28 secs ago

Let's block ads! (Why?)

How to link a NASM code and GCC in Mac OS X?

Aucun commentaire:

Enregistrer un commentaire