c语言 - 为什么当我包含 -pthreads 标志时,tcc 无法识别"main"?



我正在尝试使用带有TCC的GTK 3.0库来编译C应用程序。文档说运行到编译的命令是

gcc `pkg-config --cflags gtk+-3.0` -o [executable name] [source file] `pkg-config --libs gtk+-3.0`

我试图使用TCC编译,据我所知,语法应该相同。但是,当我使用TCC时,GCC可以很好地编译它,汇编失败了,错误:

tcc: error: undefined symbol 'main'

我将问题隔离到由pkg-config --cflags gtk+-3.0插入的-pthread标志,因此运行一个简单的" Hello,World" C程序并使用

编译

tcc -pthread -o [executable name] [source file]

导致相同的错误。我是错误的,是编译器错误还是其他?

尝试-lpthread

tcc hello.c -lpthread -o hello

最新更新