I'm trying to use this library ssem.h and sshm.h, but I'm getting the following error message:
% g++ -o Proc1 Proc1.C ssem.o sshm.o
Undefined first referenced
symbol in file
sem_create /var/tmp/ccGWnoge.o
sem_signal /var/tmp/ccGWnoge.o
sem_wait /var/tmp/ccGWnoge.o
ld: fatal: Symbol referencing errors. No output written to Proc1
collect2: ld returned 1 exit status
/*
* ssem.h
*
* Header file for "Simple Semaphore Operations"
* Version : 1.0.0
* Date: 10 Jan 2002
* Modifications: 10 Jan 2004 Updated for C++
*
*/
#ifdef __cplusplus
extern"C" {
#endif
/* Functions available to the user */
int sem_create(int key, int initial_value);
int sem_open(int key);
int sem_wait(int semid);
int sem_signal(int semid);
int sem_rm(int semid);
#ifdef __cplusplus
};
#endif
/*
* ssem.h
*
* Header file for "Simple Semaphore Operations"
* Version : 1.0.0
* Date: 10 Jan 2002
* Modifications: 10 Jan 2004 Updated for C++
*
*/
#ifdef __cplusplus
extern"C" {
#endif
/* Functions available to the user */
int sem_create(int key, int initial_value);
int sem_open(int key);
int sem_wait(int semid);
int sem_signal(int semid);
int sem_rm(int semid);
#ifdef __cplusplus
};
#endif
Problem fixed. I accidently copied the wrong file in my directory using the unix copy command. I thought I copied ssem.c but I actually copied ssem.h (for the second time) even though I named it ssem.c. So I thought I had the right files even though I didn't.