http://www.mingw.org/
By using a simple c program (dirlist.c) I was able to find the minimal files required...
core = gcc-core-3.4.5-20060117-3.tar.gz gcc.exe (gnu-c-compiler) cpp.exe (c pre processor) cc1.exe collect2.exe
stddef.h \lib\gcc\mingw32\3.4.5\include folder
crtbegin.o \lib\gcc\ming32\3.4.5
binutils
as.exe (gnu assembler)
ld.exe (loader)
mingw-runtime (i've included the whole "include" folder) stdio.h stdlib.h
crt2.o
w32api (total includes 4.28MB! so I only took the required) windows.h windef.h wincon.h winbase.h wingdi.h inuser.h winnls.h winver.h winnetwk.h winreg.h winsvc.
gcc -o winfilename.exe winfilename.c -mwindows gcc.exe -o %1.exe %1 -Iinclude -Llib -Wall -ansi -mwindows -the above command works with my old gcc setup but is missing (for the windows textout libgdi32.a libcomdlg32.a
gcc.exe -o %1.exe %1 -lws2_32 -lwsock32 -Iinclude -Llib (for winsock you'll need the lws3_32.a and lwsock.a static libws2_32.a, libwsock32.a )
/* as.exe, cc1.exe, cpp.exe, cr2.o, gcc.exe, ld.exe
/include has _mingw.h, basetyps.h, cderr.h, commdlg.h, dde.h, ddeml.h, dlgs.h, ecpt.h, lzexpand.h, nb30.h, rpc.h, rpcdce.h, rpcdcep.h, rpcnsi.h, rpcnterr.h, shellapi.h, starg.h, stddef.h, stdio.h, string.h, winbase.h, wincon.h, windef.h, windows.h, winerror.h, windgi.h, winnetwk.h, winnls.h, winnt.h, winperf.h, winsock.h, winspool.h, winsvc.h, winuser.h, winver.h winreg.h maybe sys/types.h
/lib has libadvapi32.a, libgcc.a, libkernel32.a, libmingw32.a, libmoldname.a, libmsvcrt.a, libshell32.a libuser32.a, libws2_32.a, libwsock32.a and of course this .c source file... */
gcc = gnu c compiler
gcc -c foobar.c
will compile foobar.c into an object (note that gcc can detect the .c extension and compile accordingly)
gcc -o foobar.exe foo.o bar.o
to link and load those objects together into an executable
winwithresource -i resourcescript.rc -o foo.o
my batch file command to go straight from source code to executable -also loads two static libraries (from bloodshed devcpp for winsock) -also uses switches for parameters for Include and Lib directories with included header files and Lib files...
how to setup gcc on windows -the easiest way to set up a minimal slightly customized portable gcc is to download the necessary files from the mingw sourceforge project
you will need the core package, gcc.exe cc1.exe
the binutils package as.exe ld.exe
gcc -c filename.c -Iinclude
will compile and create a filename.o (as long as you have all the headers in directory "include")
gcc3.4.5 from mingw is compiled with a specific directory structure in mind...
gcc3\libexec\gcc\mingw32\3.4.5
is where it expects to find cc1.exe, collect2.exe, ld.exe