I am getting on error on Mac OS X 10.12 involving Clang, and it does not want compile my code. I want it to compile through the compiler, but it persists me with "error: member initializer 'pthread_mutex_init' does not name a non-static data member or base class" when calling pthread_mutex_init. I have tried adding and removing "static" in front of the pthread_mutex_t declaration and I have already included my pthread header file
EDIT: yes, I included file.h in my file.cpp file. EDIT #2: I have tried mutex_ = (mutex_pthread_t)PTHREAD_MUTEX_INITIALIZER and it gives some weird error telling me to insert "{" somewhere.
Here is my code:
Memory.h:
#include <pthread.h>
class Memory {
static pthread_mutex_t mutex_;
}
Memory.cpp:
#include <Memory.h>
#include <pthread.h>
Memory::Memory() :
#ifdef __APPLE__
pthread_mutex_init(&mutex_, NULL);
#endif