tcc
TCC (Tiny C Compiler) is a command-line tool for compiling C source code files. It is known for its small size, simplicity, and fast compilation speed. TCC was developed by Fabrice Bellard and released in 2001 as free and open-source software under the GNU Lesser General Public License (LGPL).
TCC can directly compile C code to machine code without requiring the creation of intermediate object files. This makes it ideal for quick prototyping, scripting, and situations where speed is crucial. Its small binary size makes it easy to distribute and deploy.
TCC supports ANSI C standards and provides a range of optimization options to optimize the code for size, speed, or a balance of both. It produces highly optimized executables, often competing with larger and more complex compilers in terms of performance.
Being a command-line tool, TCC can be easily integrated into scripts or build systems. It supports various operating systems, including Windows, Unix-like systems, and even some embedded platforms. TCC also allows dynamic compilation and loading of C code during runtime, making it suitable for certain scripting and JIT compilation use cases.
TCC has a minimal feature set compared to larger compilers like GCC or Clang. However, it supports most standard C libraries and includes features like preprocessor directives, basic debugging support, and standard error checking. TCC's simplicity and small footprint make it a popular choice for certain applications and performance-critical scenarios.
To use TCC, you typically invoke it from the command line, providing the source file name as an argument along with any necessary options. The resulting executable can be run directly or further manipulated as needed. TCC provides a straightforward and lightweight alternative for quickly compiling C code, especially when simplicity and speed are the primary requirements.
List of commands for tcc:
-
tcc:tldr:46840 tcc: Compile and link 2 source files to generate an executable.$ tcc -o ${executable_name} ${filename1-c} ${filename2-c}try on your machineexplain this command
-
tcc:tldr:e1036 tcc: Directly run an input file like a script and pass arguments to it.$ tcc -run ${path-to-source_file-c} ${arguments}try on your machineexplain this command
-
tcc:tldr:ee1f9 tcc: Interpret C source files with a shebang inside the file.$ #!/full/path/to/tcc -runtry on your machineexplain this command