2017-02-11 90 views
0

我无法将pthread链接到我的程序。我试过gcc Tracker.c -lpthread -lwiringPi,只得到undefined reference to pthread_creat。我试图使用-lpthread-pthread。我也无法在互联网上找到解决方案。使用多线程无法在我的树莓派上编译我的C程序

+1

虽然有一个名为'creat'的函数,它用于创建文件。创建线程是通过['pthread_create']完成的(http://man7.org/linux/man-pages/man3/pthread_create.3.html)(注意尾随'e')。 –

+0

好吧。我知道这很愚蠢。对不起 –

+1

由于没有* pthread_creat *的声明,所以在连接器发生错误之前,你应该从编译器中得到一个错误。 –

回答

2

undefined reference to pthread_creat

创建一个POSIX线程调用该函数pthread_create()