title: MinGW cannot compile hello world
body: <p>I just installed MSYS and MinGW using the default GUI installer, checking all checkboxes. Then I made a simple hello world program and tried to compile it on the MSYS command line. This is what happens:</p>
  
  <pre><code>$ gcc test.c
  c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: 
     cannot find -lshell32
  c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: 
     cannot find -luser32
  c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: 
     cannot find -lkernel32
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>With a verbose flag:</p>
  
  <pre><code>$ gcc -v test.c
  Using built-in specs.
  COLLECT_GCC=C:\MinGW\bin\gcc.exe
  COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.6.2/lto-wrapper.exe
  Target: mingw32
  Configured with: ../gcc-4.6.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
  Thread model: win32
  gcc version 4.6.2 (GCC) 
  COLLECT_GCC_OPTIONS='-v' '-mtune=i386' '-march=i386'
   c:/mingw/bin/../libexec/gcc/mingw32/4.6.2/cc1.exe -quiet -v -iprefix c:\mingw\bin\../lib/gcc/mingw32/4.6.2/ test.c -quiet -dumpbase test.c -mtune=i386 -march=i386 -auxbase test -version -o C:\DOCUME~1\Owner\LOCALS~1\Temp\ccz34YZu.s
  GNU C (GCC) version 4.6.2 (mingw32)
      compiled by GNU C version 4.6.2, GMP version 5.0.1, MPFR version 2.4.1, MPC version 0.8.1
  GGC heuristics: --param ggc-min-expand=82 --param ggc-min-heapsize=98237
  ignoring nonexistent directory "c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../mingw32/include"
  ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.6.2/include"
  ignoring duplicate directory "/mingw/lib/gcc/mingw32/4.6.2/../../../../include"
  ignoring duplicate directory "c:/mingw/lib/gcc/../../include"
  ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.6.2/include-fixed"
  ignoring nonexistent directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.6.2/../../../../mingw32/include"
  ignoring duplicate directory "/mingw/include"
  #include "..." search starts here:
  #include &lt;...&gt; search starts here:
   c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include
   c:\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include
   c:\mingw\bin\../lib/gcc/mingw32/4.6.2/include-fixed
  End of search list.
  GNU C (GCC) version 4.6.2 (mingw32)
      compiled by GNU C version 4.6.2, GMP version 5.0.1, MPFR version 2.4.1, MPC version 0.8.1
  GGC heuristics: --param ggc-min-expand=82 --param ggc-min-heapsize=98237
  Compiler executable checksum: c20aed7c018482d7b62efcd5dcab2a9d
  COLLECT_GCC_OPTIONS='-v' '-mtune=i386' '-march=i386'
   c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/as.exe -o C:\DOCUME~1\Owner\LOCALS~1\Temp\ccgcJLdQ.o C:\DOCUME~1\Owner\LOCALS~1\Temp\ccz34YZu.s
  COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.6.2/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/
  LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.6.2/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../;/mingw/lib/
  COLLECT_GCC_OPTIONS='-v' '-mtune=i386' '-march=i386'
   c:/mingw/bin/../libexec/gcc/mingw32/4.6.2/collect2.exe -Bdynamic c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../crt2.o c:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtbegin.o -Lc:/mingw/bin/../lib/gcc/mingw32/4.6.2 -Lc:/mingw/bin/../lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../.. -L/mingw/lib C:\DOCUME~1\Owner\LOCALS~1\Temp\ccgcJLdQ.o -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.6.2/crtend.o
  c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lshell32
  c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -luser32
  c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lkernel32
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>What did I do wrong? Do I need Microsoft development libraries, and if I do, where can I get them?</p>