title: Create an exe file in assembly with NASM on 32-bit Windows
body: <p>I'm making a hello world program in assembly language with <em>NASM</em> on 32-bit <em>Windows 7</em>. My code is:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I save this program as <strong>hello.asm</strong>. Next, I created <strong>hello.o</strong> with: </p>
  
  <pre><code>nasm -f elf hello.asm 
  </code></pre>
  
  <p>Now I'm trying to create the <strong>exe</strong> file with this command: </p>
  
  <pre><code>ld -s -o hello hello.o 
  </code></pre>
  
  <p>But now I receive this error:</p>
  
  <blockquote>
    <p>ld is not recognized  as an internal or external command, operable program or batch</p>
  </blockquote>
  
  <p>Why am I getting this error, and how can I fix it?</p>