Salve a tutti, sto scrivendo un programma e ho riscontrato questo problema. Cercando su internet l'errore del compilatore ho capito che due header file non possono dipendere uno dall'altro. Per� non riesco a trovare una soluzione; avete dei consigli? Grazie in anticipo per le risposte, sotto inseriso il codice dei miei header file:
lista.h
codice:
#ifndef LISTA_H_INCLUDED
#define LISTA_H_INCLUDED
#include "prodotto.h"
#include "offerta.h"
typedef struct lista Lista, *l_lista;
struct lista {
l_prodotto p;
l_lista next;
int qta;
};
void LISTinsert(l_offerta offerta, l_prodotto prodotto, int qta);
l_lista LISTnew(l_prodotto prodotto, int qta);
#endif // LISTA_H_INCLUDED
offerta.h
codice:
#ifndef OFFERTA_H_INCLUDED
#define OFFERTA_H_INCLUDED
#include "lista.h"
typedef struct offerta Offerta, *l_offerta;
struct offerta {
char nome;
int prezzo_off;
int X;
l_lista l;
};
#endif // OFFERTA_H_INCLUDED
prodotto.h
codice:
#ifndef PRODOTTO_H_INCLUDED
#define PRODOTTO_H_INCLUDED
#include "offerta.h"
typedef struct prodotto Prodotto, *l_prodotto;
struct prodotto {
char *nome;
int prezzo;
Offerta *o; //da aggiustare
};
l_prodotto cercaProdotto(char *key, l_prodotto p);
#endif // PRODOTTO_H_INCLUDED