0

I am trying to compile a c application with the gtk 3.0 library with tcc. The documentation says the command to run to compile is

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

I am trying to use tcc to compile, and it from what I can tell, the syntax should be the same. However, where gcc compiles it fine, when I use tcc, compilation fails with the error:

tcc: error: undefined symbol 'main'

I isolated the problem to the -pthread flag inserted by pkg-config --cflags gtk+-3.0 Thus, running a simple "Hello, World" c program and compiling with

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

results in the same error. Am I compiling wrong, is it a compiler bug, or something else?

  • Look in the TCC documentation to see what `-pthread` means for your main program. – Jonathan Leffler Feb 07 '18 at 03:33
  • There were some recent issues with `-pthread` in TCC. See http://repo.or.cz/tinycc.git/commit/3b27b3b1d1ae953f5ecb37f5bc95758499d66971 and the two previous commits. – nemequ Feb 07 '18 at 03:57

1 Answers1

0

try -lpthread

tcc hello.c -lpthread -o hello
cjlp
  • 1