我想完成在https://developer.gnome.org/gtk3/stable/ch01s04.html上的GTK +教程,但是当我编译代码时,得到错误-pthread:command not found。我正在使用Ubuntu 17.04。我的编译命令是:GTK +教程编译错误
`pkg-config --cflags gtk+-3.0` -o exampleappwin exampleappwin.c `pkg-config --libs gtk+-3.0`
我下载的文件来自:https://git.gnome.org/browse/gtk+/tree/examples/application3,所以我知道它们是正确的。提前致谢。
根据下面的评论添加到此。收到错误:
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
后来,当我编译主,我收到错误:
/tmp/ccMOUa6f.o: In function `main':
main.c:(.text+0x19): undefined reference to `example_app_new'
collect2: error: ld returned 1 exit status
你忘了指定编译器。 – andlabs
例子:'gcc -o exampleappwin exampleappwin.c \'pkg-config --libs gtk + -3.0 \''(其中gcc是编译器as andlabs提到的) –
哇!我无法相信我做到了!我总是把它放在评论中,以便剪切和粘贴。好。我收到一个错误:'/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/Scrt1.o:函数'_start': (.text + 0x20):对'main'的未定义引用 collect2:错误:ld返回1退出状态。当我尝试编译main时,收到一个错误:'/tmp/ccMOUa6f.o:在main函数中: main .c :(。text + 0x19):未定义的引用'example_app_new' collect2:错误:ld返回1退出状态' – Guest123ABC