0

我正在尝试使用带有 tcc 的 gtk 3.0 库编译 ac 应用程序。文档说运行编译的命令是

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

我正在尝试使用 tcc 进行编译,据我所知,语法应该是相同的。但是,在 gcc 编译得很好的地方,当我使用 tcc 时,编译失败并出现错误:

tcc: error: undefined symbol 'main'

我将问题隔离到由pkg-config --cflags gtk+-3.0因此插入的 -pthread 标志,运行一个简单的“Hello, World”c 程序并编译

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

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

4

1 回答 1

0

尝试-lpthread

tcc hello.c -lpthread -o hello
于 2021-03-31T00:36:47.707 回答