尝试编译项目,并在thread.h中收到此错误。错误:未知类型名称'pthread_mutex_t'
inc/thread.h:38:15: error: unknown type name 'pthread_mutex_t'
当我看着thread.h,我看到以下内容:
#include <pthread.h>
#include "rel_assert.h"
#define MUTEX pthread_mutex_t
这是导致该错误的最后一行。 搜索后,我在pthreadtypes.h中找到了pthread_mutex_t结构体定义,所以我试图包含它。然后我以下错误:
inc/pthreadtypes.h:16:3: error: #error "Never include <bits/pthreadtypes.h> directly; use <sys/types.h> instead." inc/pthreadtypes.h:23:24: fatal error: bits/sched.h: No such file or directory compilation terminated.
如果我有<sys/types.h>
相反,我回到我原来的错误。 任何想法如何解决这个问题。
UPDATE1 尽量把主要的是这样开始时来定义它:
#include <pthread.h>
//#include <libbladeRF.h>
#include <sys/types.h>
int main()
{
pthread_mutex_t m;
return 0;
}
当我做一个独立的C文件,并在命令行编译GCC这个实际工作。但在该项目中,我收到错误。当我创建项目时,我一定做错了什么。将再试一次。
由于错误提示你:还包括''(而不是'') –
那么你包含哪些文件? –
试着把'pthread_mutex_t MUTEX'没有'#define' –