Strukturen in Bibliotheken

AevumDomi

Newbie
Registriert
Feb. 2017
Beiträge
5
Hallo Leute,

ich möchte gerne eine Struktur aus einem Hauptprogramm main.c in eine Unterfunktion übertragen, welche sich in einer Bibliothek Aktienprogramm.h befindet. Obwohl ich die Anwendung genau wie im Hauptprogramm aufgebaut habe streikt die Anwendung.
Fehlerausgabe :
error : dereferencing pointer to incomplete type 'struct aktie_h' printf("%s",(a_ptr->name));

Leider bin ich im Umgang mit Strukturen noch nicht allzu bewandert, ein Tipp wäre nett!

/* Hauptprogramm */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "Aktienprogramm.h"
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

struct aktie_h{
char name[MAX];
char termin[MAX];
char KGV[MAX];
char rendite[MAX];
char min[MAX];
char max[MAX];
} Aktie_Hinz;

int main()
{
//Deklaration
int wahl;

//Startbildschirmausgabe
printf("\n");
printf("\t 1: Aktie hinzufügen\n");
printf("\t 2: Aktuelle Kurse anzeigen\n");
printf("\t 3: Analyse starten\n");
printf("\t 4: Kontostand anzeigen\n");
printf("\t 5: Aktie kaufen\n");
printf("\t 6: Aktie verkaufen\n\n");
printf("Option wählen : ");
scanf("%d",&wahl);

//Programmausführung
switch(wahl)
{
case 1 : printf("\nIhre wahl war : ---Aktie hinzufügen---\n\n");
printf("Namen der Aktie ein : \n");
getchar();
fgets(Aktie_Hinz.name,MAX,stdin);
printf("\nTermin der Hauptversammlung : \n");
fgets(Aktie_Hinz.termin,MAX,stdin);
printf("\nKGV : \n");
fgets(Aktie_Hinz.KGV,MAX,stdin);
printf("\nErwartete Dividendenrendite : \n");
fgets(Aktie_Hinz.rendite,MAX,stdin);
printf("\nMinimum : \n");
fgets(Aktie_Hinz.min,MAX,stdin);
printf("\nMaximum : \n");
fgets(Aktie_Hinz.max,MAX,stdin);
ausgabe(&Aktie_Hinz);
AddShares(&Aktie_Hinz);
break;
default : printf("Eingabe ungültig\n");
}
return 0;
}

/* Bibliothek */
#ifndef _Akienprogramm_
#define _Aktienprogramm_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

#define MAX 30

void AddShares(struct aktie_h *a_ptr)
{
//Deklaration
FILE *b;

//Programmausführung
printf("%s",(a_ptr->name));
}
 
Bitte nimm in Zukunft die \[code\] Tags die das Forum anbietet.

Du musst beidesmal die Struktur deklarieren. Ich sehe in der Bibliotheke keine Deklaration.
 
Zurück
Oben