No funciona en mi c++ me sale un error;
    
Código C++:
Ver original- #include <sys/ipc.h> 
- #include <stdio.h> 
- #include <stdlib.h> 
- #include <sys/types.h> 
- #include <sys/sem.h> 
- #include <unistd.h> 
-   
- /*struct sembuf{ 
-     unsigned short sem_num; 
-         short sem_op; 
-         short sem_flg; 
- };*/ 
-   
- union semun { 
-         int val;                    /* value for SETVAL */ 
-         struct semid_ds *buf;       /* buffer for IPC_STAT, IPC_SET */ 
-         unsigned short int *array;  /* array for GETALL, SETALL */ 
-         struct seminfo *__buf;      /* buffer for IPC_INFO */ 
-     }; 
-   
- typedef union semun arg; 
-   
-   
-   
-   
- int semWait(int semID, short semNumber){ 
-     int r; 
-     struct sembuf operacion[1]; 
-     operacion[0].sem_num = semNumber; 
-     operacion[0].sem_op = -1; 
-     operacion[0].sem_flg = 0; 
-     r = semop(semID,operacion,1); 
-     return r; 
- } 
-   
- int semSignal(int semID, int semNumber){ 
-     int r; 
-     struct sembuf operacion[1]; 
-     operacion[0].sem_num = semNumber; 
-     operacion[0].sem_op = 1; 
-     operacion[0].sem_flg = 0; 
-     r = semop(semID,operacion,1); 
-     return r; 
- }    
-   
- void printInfo(arg valores, int q){ 
-     int i; 
-     printf("valor actual del semaforo :\n"); 
-     for (i = 0; i<q;i++){ 
-         printf("\t sem[%d] = %d\n",- i ,- valores. array[- i ]);
 
-     } 
-   
- } 
-   
- int setValores(int *ID, int valor, int q){ 
-     int i; 
-     arg valoresSem; 
-     valoresSem. array = (unsigned short int *)malloc (sizeof(unsigned short int)*- q );
-     for(i = 0; i<q; i ++){ 
-         valoresSem.array[i] = valor; 
-          
-     } 
-         semctl(*ID,0,SETALL,valoresSem); 
- } 
-   
- int main(int argc, char* argv[]){ 
-   
-     int semaforoID; 
-     short qSem = 2; 
-     arg valoresSem; 
-     valoresSem. array = (unsigned short int *)malloc (sizeof(unsigned short int)*- qSem );
-     int i; 
-   
-   
-     semaforoID = semget(ftok(argv[0],2), qSem, IPC_CREAT | 0666); 
-   
-   
-     setValores(&semaforoID,0,2); 
-     semctl(semaforoID,0,GETALL,valoresSem); 
-   
-     printInfo(valoresSem,2); 
-     sleep(1); 
-     for (i = 0; i< 2 ; i++){  
-         if (fork() == 0){ 
-             semWait(semaforoID,0); //Espera a que el padre lo deje entrar 
-             semSignal(semaforoID,1); //le da lugar al padre 
-              
-         } 
-     } 
-   
-   
-     printf("libera el 1er hijo\n"); 
-     semSignal(semaforoID,0); //Libera un hijo 
-      
-     semWait(semaforoID,1); //Espera a que el hijo termine 
-     printf("libera el 2do hijo\n"); 
-     semSignal(semaforoID,0); //Libera un hijo 
-     semWait(semaforoID,1); //Espero que termine el hijo 
-   
-     semSignal(semaforoID,0); //Libera al pedo para ver el valro 
-     semctl(semaforoID,0,GETALL,valoresSem); 
-     printInfo(valoresSem,2); 
-   
-     semctl(semaforoID,qSem , IPC_RMID); 
-   
-   
-     return 0; 
- } 
A que se debee este error