tcc
Tiny C Compiler
TLDR
Compile and run
SYNOPSIS
tcc [-run] [-o output] [-c] [-l lib] [options] files
DESCRIPTION
tcc (Tiny C Compiler) is an extremely fast C compiler that can also serve as a C script interpreter. Its primary feature is compilation speed — TCC compiles several times faster than GCC, making it suitable for rapid development iterations and using C as a scripting language.
The -run flag compiles source code directly into memory and executes it immediately without creating intermediate object files or executables. Arguments after -- are passed to the compiled program. This enables workflows where C files are treated like scripts, including use in shebangs.
TCC supports most of the C99 standard along with common GCC extensions for compatibility. It can generate executables, object files, and shared libraries. A built-in bounds checker (-b) catches buffer overflows and out-of-bounds access at runtime without requiring external tools like Valgrind. Despite its small size, TCC is capable enough to compile itself.
PARAMETERS
-run
Compile and run immediately.-o FILE
Output file.-c
Compile to object file only.-shared
Create shared library.-l LIB
Link library.-L DIR
Library search path.-I DIR
Include search path.-D NAME
Define preprocessor macro.-g
Generate debug info.-b
Enable bounds checking.-Wall
Enable warnings.-v
Verbose mode.
CAVEATS
Optimization is minimal - generated code is slower. Some C features may differ from GCC. Not suitable for production builds needing performance.
HISTORY
TCC was created by Fabrice Bellard around 2001. Bellard is known for QEMU, FFmpeg, and other influential projects. TCC demonstrates that a full C compiler can be very small and fast.
