enter image description here

writes that the variable Init was declared differently. Here I announced it:

#ifndef LIB_H #define LIB_H #include <stdio.h> #include "stack.h" void addProcess(struct Cell **); void deleteOneProcess(struct ProcessInfo); void deleteAll(struct Cell **); void Init(struct ProcessInfo*); int get_button(); #endif 

and here caused:

 void Init() { key_t key = ftok("main.c", 228); int SemID = semget(key,1,0666 | IPC_CREAT); semctl(SemID, 0, SETVAL,0); } 

How can I fix it?

  • No, writes that the announcement does not match the implementation. with Init (strcut ...) arguments and without Init () - add arguments - Alexander Chernin
  • Well, as it was said earlier: why do not the declaration of the Init function coincide with the definition? And why is your question entitled “multiple declarations in one variable”? Where did you see this? - AnT

3 answers 3

Your implementation and prototype functions do not match. The prototype has a struct ProcessInfo * argument, but no longer in its implementation.

    The error message is clear enough

    arguments does not match prototype

    namely

    the number of arguments does not match the function prototype

    That is, you call a function without passing any argument to it, while the function is declared as having one parameter.

     void Init(struct ProcessInfo*); 

    Furthermore, you define this function without the parameter

     void Init() { key_t key = ftok("main.c", 228); int SemID = semget(key,1,0666 | IPC_CREAT); semctl(SemID, 0, SETVAL,0); } 

    By the way, this is not a function call, but its definition. You call a function in some other place (signals_lin.c: 77: 1).

    You need to match the declaration of this function with its definition (either the function has a parameter, and must be called with the appropriate argument, or it does not have a parameter, and it must be called without an argument).

      The error is completely different. The Init() function expects struct ProcessInfo* as an argument, but receives nothing. Change

       void Init(struct ProcessInfo*); 

      on

       void Init(); 

      (anyway, ProcessInfo* is not used in the function).