I'm making a hello world program in assembly language with NASM on 32-bit Windows 7. My code is:
section .text
global main ;must be declared for linker (ld)
main: ;tells linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
msg db 'Hello, world!', 0xa ;our dear string
len equ $ - msg ;length of our dear string
I save this program as hello.asm. Next, I created hello.o with:
nasm -f elf hello.asm
Now I'm trying to create the exe file with this command:
ld -s -o hello hello.o
But now I receive this error:
ld is not recognized as an internal or external command, operable program or batch
Why am I getting this error, and how can I fix it?