tcc 使用

tcc(Tiny C Compiler)是一个轻量级的 C 编译器。可以将 C 语言以脚本的形式运行。

  1. 安装 tcc:

    sudo apt install tcc
    
  2. 编写代码:

    vim main.c
    
    #!/usr/bin/tcc -run
    
    #include <stdio.h>
    int main() {
        printf("Hello, world!");
        return 0;
    }
    
  3. 运行程序:

    chmod +x main.c
    ./main.c
    
posted @ 2025-06-17 02:39  Undefined443  阅读(21)  评论(0)    收藏  举报