title: Trouble building YASM/NASM Hello World
body: <p>I'm trying to build <a href="https://github.com/mcandre/mcandre/tree/master/nasm/hello" rel="nofollow">hello.asm</a> into a Windows executable, but when I use the suggested commands for assembling, linking, and compiling the code, I get errors. Whether I'm using <a href="http://strawberryperl.com/" rel="nofollow">Strawberry Perl</a>'s GCC or <a href="http://www.mingw.org/" rel="nofollow">MinGW</a>'s GCC, both give errors for the same YASM/NASM code.</p>
  
  <p>Here are the traces. Either I'm doing something wrong in my Makefile or .ASM, or the linking process is buggy. Either way, I'd like someone to help me resolve the errors.</p>
  
  <p>I get the same result whether I use nasm or yasm to assemble the object file.</p>
  
  <p>Strawberry Perl GCC Trace:</p>
  
  <pre><code>C:\&gt; make
  nasm -f win32 -l hello.lst hello.asm
  gcc -o hello hello.o
  ld: cannot find crt1.o: No such file or directory
  ld: cannot find -lmingw32
  ld: cannot find -lgcc
  ld: cannot find -lmoldname
  ld: cannot find -lcrtdll
  ld: cannot find -luser32
  ld: cannot find -lkernel32
  ld: cannot find -ladvapi32
  ld: cannot find -lshell32
  ld: cannot find -lmingw32
  ld: cannot find -lgcc
  ld: cannot find -lmoldname
  ld: cannot find -lcrtdll
  make: *** [hello] Error 1
  </code></pre>
  
  <p>MinGW GCC Trace:</p>
  
  <pre><code>$ make
  gcc -o hello hello.o
  c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libmingw32.a(main.o):main.c:(.text+0x104): undefined reference to `WinMain@16'
  collect2: ld returned 1 exit status
  make: *** [hello] Error 1
  </code></pre>
  
  <p>Specs:</p>
  
  <ul>
  <li>YASM 1.2.0</li>
  <li>NASM 2.10.05</li>
  <li>Strawberry Perl gcc 4.4.3</li>
  <li>MinGW gcc 4.5.2</li>
  <li>Strawberry Perl 5.12</li>
  <li>MinGW 0.1</li>
  <li>Windows 7 Professional x64</li>
  <li>MacBook Pro 2009</li>
  </ul>