So I am getting the error: "undefined reference to sem_open()" even though I have include the semaphore.h header. The same thing is happening for all my pthread function calls (mutex, pthread_create, etc). Any thoughts? I am using the following command to compile:
g++ '/home/robin/Desktop/main.cpp' -o '/home/robin/Desktop/main.out'
#include <iostream>
using namespace std;
#include <pthread.h>
#include <semaphore.h>
#include <fcntl.h>
const char *serverControl = "/serverControl";
sem_t* semID;
int main ( int argc, char *argv[] )
{
//create semaphore used to control servers
semID = sem_open(serverControl,O_CREAT,O_RDWR,0);
return 0;
}