Eclipse tells me that I have mutliple Definitions of a function. I just can't spot the mistake. This is my main.c
#include <stdio.h>
#include "kontaktverzeichnis.h"
int main(){
kontakt_hinzufuegen();
return 0;
}
This is the header:
#ifndef KONTAKTVERZEICHNIS_H_
#define KONTAKTVERZEICHNIS_H_
#include "kontaktfunktionen.c"
int kontakt_hinzufuegen();
#endif /* KONTAKTVERZEICHNIS_H_ */
and this is kontaktfunktionen.c
#include <stdio.h>
kontakt[];
kontakt_hinzufuegen(){
int i = 0;
printf("Bisher sind %i Kontakte angelegt.",kontakt[i]);
kontakt[i++];
}
struct kontaktname{
char* name;
char* vorname;
};
struct kontaktanschrift{
char* strasse;
int hausnummer;
int plz;
char* ort;
char* land;
};
Where is my error?
Do not
#includeanything in your header file. And do a#include "kontaktverzeichnis.h"in thekontaktfunktionen.cfile.As @StoryTeller commented, define your
kontakt_hinzufuegen()asint kontakt_hinzufuegen()in thekontaktfunktionen.cfile and return anintvalue from the functionkontakt_hinzufuegenas for ex::