Utiliser Nasm sous Mac OS
Bonsoir et joyeuse fête
Je vous explique mon souci :
J'ai récemment acquis un Mac OS (Mountain Lion) et étudiant en informatique, je compilais autrefois sous Windows.
Exemple de programme :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| %include "iut.inc"
segment .text
global start
start:
mov eax, msg_Accueil
call write_string
call read_char
si1:
cmp al, 'j'
jne sinon1
alors1:
mov eax, msgJ
call write_string
jmp finsi1
sinon1:
si2:
cmp al, 'n'
jne sinon2
alors2:
mov eax, msgN
call write_string
jmp finsi2
sinon2:
mov eax, msgERREUR
call write_string
jmp start
finsi2:
finsi1:
ret
segment .data
msg_Accueil: db "Tapez le caractere j pour vive le jour",10,
db "ou n pour vive la nuit",10,0
msgJ: db 10,"Vive le jour",10,0
msgN: db 10,"Vive la nuit",10,0
msgERREUR: db 10,"ERREUR",10,"Recommencez",10,0 |
Donc autrefois , pour compiler , il me suffisait de faire :
Code:
1 2
| nasm f win32 exemple.asm
gcc o exemple.exe exemple.obj L. lIUT |
Puis quand j'essaie , cela me dit :
Citation:
ld: warning: ld: warning: ignoring file ./libIUT.a, file was built for archive which is not the architecture being linked (x86_64): ./libIUT.aignoring file Jour_nuit_Erreur.obj, file was built for unsupported file format ( 0x4c 0x 1 0x 2 0x 0 0x72 0xff 0xe1 0x50 0x72 0x 1 0x 0 0x 0 0x2a 0x 0 0x 0 0x 0 ) which is not the architecture being linked (x86_64): Jour_nuit_Erreur.obj
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Je dispose des librairies fonctionnant soit sous Windows soit Linux seulement.
J'espère que vous saurez m'aider pour réussir à compiler et exécuter. :)