[英]Ambiguous Reference for type pthread_mutex_t
I have declared 我已经宣布了
pthread_mutex_t mutex=PTHREAD_MUTEX_INITIALIZER;
in the global space of my main program, main.cpp. 在我的主程序的全局空间main.cpp。
However, whenever I try to refer to it in a function definition, for example, 但是,每当我尝试在函数定义中引用它时,例如,
void foo(void)
{
pthread_mutex_lock(&mutex);
...
}
the following error message will be displayed: 将显示以下错误消息:
reference to 'mutex' is ambiguous 对'互斥'的引用含糊不清
Any idea what's going on? 知道发生了什么事吗? If it helps, this is being written in xcode, and I have included in the header of the program. 如果它有帮助,这是用xcode编写的,我已经包含在程序的标题中。
It turns out after I changed to name from mutex to mutex1, the errors disappeared. 事实证明,在我从互斥锁更名为mutex1后,错误消失了。 I guess because mutex is a function somewhere... 我想因为互斥是一个功能...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.