Bonsoir a tous,

Je n'arrive pas à comprendre les erreurs affichées par le compilateur.

Coici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
 
typedef struct sac_sol
{int items[nbItems];
int nombr;
double profit[nbfcts];
float fitness;
int explored;
}sac;
 
sac archive[100000];
int nb_solution=100;
 
void compute_ind_fitness( sac, sac*);
void compute_all_fitness(sac *archive); 
 
void compute_all_fitness(sac *archive){
  int i;
  for (i=0;i<nb_solution;i++)
  compute_ind_fitness(archive[i], archive);
}
 
/* compute the fitness of x according to the population P */
void compute_ind_fitness(sac x,sac *archive){
  int j;
  init_fitness(x);
  for (j=0;j<nb_solution;j++){
    if (archive[j].items!=x.items && archive[j].profit!=x.profit){
      update_fitness(x,calcIndicatorValue(archive[j],x,indicator));
    }
  }
}
 
void main ()
{ int i;
 
 for (i=0;i<nb_solution;i++)
compute_all_fitness(archive[i]);}
Le compilateur m'affiche une erreur au niveau du ligne 38 : error: incompatible type for argument 1 of 'compute_all_fitness'
Note au niveau du ligne 17 : note: expected 'struct sac *' but argument is of type 'sac'