Ambiguous reference for type pthread_mutex_t
I announced
pthread_mutex_t mutex=PTHREAD_MUTEX_INITIALIZER;
in the global space of my main program main.cpp.
However, when I try to refer to it in a function definition, for example
void foo(void)
{
pthread_mutex_lock(&mutex);
...
}
the following error message appears:
reference to "mutex" is ambiguous
Any idea what's going on? If it helps, it gets recorded in xcode and I have included it in the program header.
+3
source to share