title: Outsourcing several Functions into multiple C Files
body: <p>I have a problem with my code. I have programmed a pharmacy management system (2000 loc). Now I want to outsource several functions (Supplier(6 functions), Customer(6 functions) and Medizine(9 functions)) into 3 c Files.</p>
  <p>The code works perfectly fine in one C function but somehow it gives me errors when putting it into different .c Files. It seems like it has to do something with my header file which is included in every .c File. Because it says that there are multiple declarations of stuff from the header.(It worked when only having 1 .c File).</p>
  <p>These are the errors when compiling:<br />
  <a href="https://i.stack.imgur.com/iLSWN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iLSWN.png" alt="Errors when compiling" /></a>.</p>
  <p>This is my header File:</p>
  <pre><code>#ifndef MAINPROJECTNIKLASLOREK_H_
  #define MAINPROJECTNIKLASLOREK_H_
  
  //Anlegen eines const char pointer um das Format des Medizinstructs festzulegen und später
  bei printf Ausgaben direkt anzuwenden
  const char* medicine_format =&quot;\n\tMediID:%s\n\tMediName:%s\n\tQuantity:%d\n\tPrice:%.2f    
  \n\tExp.Date:%s\n\tCompany:%s\n\tSupplier:%s\n\tInfo:%s\n&quot;;
  //Anlegen eines Structs für die Medizin
  struct Medicine{
  int quantity;
  float price;
  char expdate[15];
  char company[20];
  char supplier[30];
  char mediname[20];
  char info[1000];
  char mediid [30];
  };
  const char* supplier_format = &quot;\n\tSupplierID:\t%s\n\tSupplierName:\t%s\n\tMobileNumber:  
  \t%s\n\tCompany:\t%s\n&quot;;
  //Anlegen eines Structs für die Zulieferer
  struct Supplier{
  char supplierid[30];
  char suppliername[30];
  char mobno[15];
  char company[50];
  };
  
  const char* customer_format = &quot;\n\tCustomerID:\t%s\n\tCustomerName:\t%s\n\tMobileNumber:  
  \t%s\n&quot;;
  //Anlegen eines Structs für die Kunden
  struct Customer{
  char customerid[30];
  char customername[30];
  char mobno[15];
  };
  // Struct um Kassenzettel einzuspeichern
  struct bill{
  char billid[30];
  char mediname[30];
  int medi_qty;
  float price;
  float total;
  float newtotal;
  float temptotal;
  };
  
  //Globale Variablen für Coupon und Prozent. Diese werden von der Main Funktion überschrieben,     
  wenn sie benutzt werden.
  //Sie werden nur! in der Sellmed Funktion angewendet, um einen Discount auf einen Medizin     
  Verkauf anzuwenden.
  #define SIZE 20
  char coup[SIZE]={'n','o','c','o','u','p'};
  float dis = 1.00;
  
  //main menu Funktion:
  void mainmenu();
  //Kunde Funktionen Prototypen:
  void customer();
  void addcus();
  void cuslist();
  void searchcus();
  void editcus();
  void deletecus();
  //Zulieferer Funktionen Prototypen:
  void supplier();
  void addsup();
  void suplist();
  void searchsup();
  void editsup();
  void deletesup();
  
  //Medizin Funktionen Prototypen:
  void medicine ();
  void leave();
  void addmed();
  void sellmed();
  void listing();
  void searchmed();
  void editmed();
  void deletemed();
  void pharwelc();
  
  // Bestandsfunktionen Prototypen:
  void searchstock();
  void stock();
  
  #endif /* MAINPROJECTNIKLASLOREK_H_ */
  </code></pre>