0.在https://sourceforge.net/projects/mingw-w64/下载最新的mingw压缩包,解压到D:\目录。我选择的是win32版本。解压后的目录是D:\mingw32。

1.设置环境变量

set path=%path%;D:\mingw32\bin
set include=%include%;D:\mingw32\include
set lib=%lib%;D:\mingw32\lib

2.把下载的压缩包文件解压缩。进入win32目录。

D:\tcc-0.9.26\win32>dir

 D:\tcc-0.9.26\win32 的目录

2016/10/12  08:37              .
2016/10/12  08:37              ..
2013/02/15  22:24             1,766 build-tcc.bat
2016/10/12  08:37              examples
2016/10/12  08:37              include
2016/10/12  08:37              lib
2013/02/15  22:24             4,505 tcc-win32.txt
2016/10/12  08:37              tools

3.运行批处理文件

D:\tcc-0.9.26\win32>build-tcc

D:\tcc-0.9.26\win32>echo #define TCC_VERSION "0.9.26" 1>..\config.h

D:\tcc-0.9.26\win32>gcc -Os -s -fno-strict-aliasing -DTCC_TARGET_PE -DTCC_TARGET_I386 tools/tiny_impdef.c -o tiny_impdef.exe

D:\tcc-0.9.26\win32>gcc -Os -s -fno-strict-aliasing -DTCC_TARGET_PE -DTCC_TARGET_I386 tools/tiny_libmaker.c -o tiny_libmaker.exe

D:\tcc-0.9.26\win32>if not exist libtcc\nul mkdir libtcc

D:\tcc-0.9.26\win32>copy ..\libtcc.h libtcc\libtcc.h
已复制         1 个文件。

D:\tcc-0.9.26\win32>gcc -Os -s -fno-strict-aliasing -DTCC_TARGET_PE -DTCC_TARGET_I386 -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -
Wl,-out-implib,libtcc/libtcc.a

D:\tcc-0.9.26\win32>tiny_impdef libtcc.dll -o libtcc/libtcc.def

D:\tcc-0.9.26\win32>gcc -Os -s -fno-strict-aliasing -DTCC_TARGET_PE -DTCC_TARGET_I386 ../tcc.c -o tcc.exe -ltcc -Llibtcc
../tcc.c: In function 'execvp_win32':
../tcc.c:81:39: warning: passing argument 3 of 'spawnvp' from incompatible pointer type [-Wincompatible-pointer-types]
     int ret = spawnvp(P_NOWAIT, prog, (char const*const*)argv);
                                       ^
In file included from ../tcc.c:78:0:
D:/mingw32/i686-w64-mingw32/include/process.h:191:20: note: expected 'char * const*' but argument is of type 'const char * const*'
   intptr_t __cdecl spawnvp(int,const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
                    ^~~~~~~

D:\tcc-0.9.26\win32>copy ..\include\*.h include
..\include\float.h
..\include\stdarg.h
..\include\stdbool.h
..\include\stddef.h
..\include\tcclib.h
..\include\varargs.h
已复制         6 个文件。

D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c ../lib/libtcc1.c

D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/crt1.c

D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/wincrt1.c

D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/dllcrt1.c

D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/dllmain.c

D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c lib/chkstk.S

D:\tcc-0.9.26\win32>goto lib32

D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c ../lib/alloca86.S

D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c ../lib/alloca86-bt.S

D:\tcc-0.9.26\win32>.\tcc -DTCC_TARGET_PE -DTCC_TARGET_I386 -c ../lib/bcheck.c
../lib/bcheck.c:46: warning: #warning Bound checking does not support malloc (etc.) in this environment.

D:\tcc-0.9.26\win32>tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o

D:\tcc-0.9.26\win32>del *.o
D:\tcc-0.9.26\win32>dir *.exe

 D:\tcc-0.9.26\win32 的目录

2016/10/12  09:01            17,920 tcc.exe
2016/10/12  09:00            15,872 tiny_impdef.exe
2016/10/12  09:00            15,360 tiny_libmaker.exe

4.执行tcc.exe

D:\tcc-0.9.26\win32>tcc
tcc version 0.9.26 - Tiny C Compiler - Copyright (C) 2001-2006 Fabrice Bellard
Usage: tcc [options...] [-o outfile] [-c] infile(s)...
       tcc [options...] -run infile [arguments...]
General options:
  -c          compile only - generate an object file
  -o outfile  set output filename
。。。

5.最新的tcc源代码在http://repo.or.cz/w/tinycc.git,在win32下多了个vc2015目录,里面有相应的sln和proj文件。编译应该就更方便了。