Erreurs incompréhensibles !
salut,
j'ai une classe Approximations avec un fichier header :
Code:
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
| // Approximations.h: interface for the Approximations class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_Approximations_H__E1FB3C28_8815_485C_874F_C10735AE4707__INCLUDED_)
#define AFX_Approximations_H__E1FB3C28_8815_485C_874F_C10735AE4707__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "RA_Data.h"
#include "Vecteur.h"
class Approximations
{
public:
Approximations();
Approximations(RA_Data *rad);
Approximations(RA_Data *rad, double min, double max);
Approximations(const Approximations &right);
~Approximations();
Approximations & operator=(const Approximations &right);
int operator==(const Approximations &right) const;
int operator!=(const Approximations &right) const;
double calculer_dmin (Vecteur vect);
double calculer_dmax (Vecteur vect);
double distance (Vecteur vect);
const RA_Data * get_La_Ra_Data () const;
void set_La_Ra_Data (RA_Data * value);
private:
const double get_dmin () const;
void set_dmin (double value);
const double get_dmax () const;
void set_dmax (double value);
private:
double dmin;
double dmax;
RA_Data *La_Ra_Data;
};
//-----------fonctions membre inline
inline const double Approximations::get_dmin () const
{
return dmin;
}
inline void Approximations::set_dmin (double value)
{
dmin = value;
}
inline const double Approximations::get_dmax () const
{
return dmax;
}
inline void Approximations::set_dmax (double value)
{
dmax = value;
}
inline const RA_Data * Approximations::get_La_Ra_Data () const
{
return La_Ra_Data;
}
inline void Approximations::set_La_Ra_Data (RA_Data * value)
{
La_Ra_Data = value;
}
#endif // !defined(AFX_Approximations_H__E1FB3C28_8815_485C_874F_C10735AE4707__INCLUDED_) |
et un fichier source :
Code:
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
| // Approximations.cpp: implementation of the Approximations class.
//
//////////////////////////////////////////////////////////////////////
#include <iostream.h>
#include <math.h>
#include "Approximations.h"
#include "RA_Data.h"
#include "Vecteur.h"
#include "MBR.h"
Approximations::Approximations()
{
dmin=0;
dmax=0;
}
Approximations::Approximations(RA_Data *rad)
{
La_Ra_Data=rad;
dmin=0;
dmax=0;
}
Approximations::Approximations(RA_Data *rad, double min, double max)
{
La_Ra_Data=rad;
dmin=min;
dmax=max;
}
Approximations::Approximations(const Approximations &right)
{
}
Approximations::~Approximations()
{
}
Approximations & Approximations::operator=(const Approximations &right)
{
if (this!=&right){
dmin=right.dmin;
dmax=right.dmax;
La_Ra_Data=right.La_Ra_Data;
}
return *this;
}
int Approximations::operator==(const Approximations &right) const
{
if (dmin!=right.dmin || dmax!=right.dmax || La_Ra_Data!=right.La_Ra_Data)
return 0;
else
return 1;
}
int Approximations::operator!=(const Approximations &right) const
{
if (dmin==right.dmin && dmax==right.dmax && La_Ra_Data==right.La_Ra_Data)
return 0;
else
return 1;
}
double Approximations::calculer_dmin (Vecteur vect)
{
int i;
double d=0;
MBR mbr=La_Ra_Data->get_La_data_page()->get_Le_MBR();
Vecteur inf,sup;
inf=mbr.get_vectinf();
sup=mbr.get_vectsup();
for(i=0;i<2;i++){
if (vect[i]<inf[i])
d+=pow(vect[i]-inf[i],2);
if (vect[i]>sup[i])
d+=pow(vect[i]-sup[i],2);
}
return d;
}
double Approximations::calculer_dmax (Vecteur vect)
{
int i;
double val,max=0;
MBR mbr=La_Ra_Data->get_La_data_page()->get_Le_MBR();
Vecteur *v,vp;
v=mbr.sommets();
for(i=0;i<4;i++){
vp=v[i];
val=sqrt(pow(vp[0]-vect[0],2)+pow(vp[1]-vect[1],2));
if (val>max)
max=val;
}
return max;
}
/*
double Approximations::distance (Vecteur vect)
{
}
*/ |
et une autre classe RA_Data avec un fichier header :
Code:
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
| // RA_Data.h: interface for the RA_Data class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_RA_DATA_H__4399E2B7_EFFA_426B_BD68_847ED560A349__INCLUDED_)
#define AFX_RA_DATA_H__4399E2B7_EFFA_426B_BD68_847ED560A349__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Approximations.h"
#include "Data_page.h"
//class RA_Page;
class RA_Data
{
public:
RA_Data();
RA_Data(int n,char *ad, char *af, Data_page *dp);
RA_Data(int n,char *ad, char *af, Data_page *dp, Approximations *a);
RA_Data(const RA_Data &right);
~RA_Data();
RA_Data & operator=(const RA_Data &right);
int operator==(const RA_Data &right) const;
int operator!=(const RA_Data &right) const;
//Data_page page ();
//const RA_Page * get_the_RA_Page () const;
//void set_the_RA_Page (RA_Page * value);
const Approximations * get_Approximations () const;
void set_Approximations (Approximations * value);
const Data_page * get_La_data_page () const;
void set_La_data_page (Data_page * value);
private:
//int rid;
//RA_Page *the_RA_Page;
int nb_data;
char *approx_debut;
char *approx_fin;
static int bi;
Approximations *approx;
Data_page *La_data_page;
private:
const int get_nb_data () const;
void set_nb_data (int value);
//const int get_rid () const;
//void set_rid (int value);
const char *get_approx_debut () const;
void set_approx_debut (char *value);
const char *get_approx_fin () const;
void set_approx_fin (char *value);
static const int get_bi ();
static void set_bi (int value);
};
//-----------fonctions membre inline
//Nombre de Données dans la RA Data
inline const int RA_Data::get_nb_data () const
{
return nb_data;
}
inline void RA_Data::set_nb_data (int value)
{
nb_data = value;
}
//l'id de la RA Data
/*
inline const int RA_Data::get_rid () const
{
return rid;
}
inline void RA_Data::set_rid (int value)
{
rid = value;
}
*/
//l'Approximations de Début
inline const char * RA_Data::get_approx_debut () const
{
return approx_debut;
}
inline void RA_Data::set_approx_debut (char *value)
{
approx_debut = value;
}
//l'Approximations de Fin
inline const char * RA_Data::get_approx_fin () const
{
return approx_fin;
}
inline void RA_Data::set_approx_fin (char *value)
{
approx_fin = value;
}
//le nombre de bits par dimension
inline const int RA_Data::get_bi ()
{
return bi;
}
inline void RA_Data::set_bi (int value)
{
bi = value;
}
//la RA Page correspondante
/*
inline const RA_Page * RA_Data::get_the_RA_Page () const
{
return the_RA_Page;
}
inline void RA_Data::set_the_RA_Page (RA_Page * value)
{
the_RA_Page = value;
}
*/
//l'Approximations correspondante
inline const Approximations * RA_Data::get_Approximations () const
{
return approx;
}
inline void RA_Data::set_Approximations (Approximations * value)
{
Approximations = value;
}
//la Data Page correspondante
inline const Data_page * RA_Data::get_La_data_page () const
{
return La_data_page;
}
inline void RA_Data::set_La_data_page (Data_page * value)
{
La_data_page = value;
}
#endif // !defined(AFX_RA_DATA_H__4399E2B7_EFFA_426B_BD68_847ED560A349__INCLUDED_) |
et un fichier source :
Code:
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| // RA_Data.cpp: implementation of the RA_Data class.
//
//////////////////////////////////////////////////////////////////////
#include "Approximations.h"
#include "RA_Data.h"
#include "Data_page.h"
int RA_Data::bi;
RA_Data::RA_Data()
{
nb_data=0;
}
RA_Data::RA_Data(int n, char *ad, char *af, Data_page *dp){
nb_data=n;
approx_debut=ad;
approx_fin=af;
La_data_page=dp;
}
RA_Data::RA_Data(int n,*char ad, *char af, Data_page *dp, Approximations *a){
nb_data=n;
approx_debut=ad;
approx_fin=af;
La_data_page=dp;
approx=a;
}
/**/
RA_Data::RA_Data(const RA_Data &right)
{
}
RA_Data::~RA_Data()
{
}
RA_Data & RA_Data::operator=(const RA_Data &right)
{
if (this!=&right){
nb_data=right.nb_data;
approx_debut=right.approx_debut;
approx_fin=right.approx_fin;
La_data_page=right.La_data_page;
approx=right.approx;
}
return *this;
}
int RA_Data::operator==(const RA_Data &right) const
{
if (nb_data==right.nb_data && approx_debut==right.approx_debut && approx_fin==right.approx_fin && La_data_page==right.La_data_page && Approximations=right.approx)
return 1;//
else
return 0;
}
int RA_Data::operator!=(const RA_Data &right) const
{
if (nb_data==right.nb_data && approx_debut==right.approx_debut && approx_fin==right.approx_fin && La_data_page==right.La_data_page && Approximations=right.approx)
return 0;//&& Approximations=right.Approximations
else
return 1;
}
/*
Data_page RA_Data::page ()
{
}
*/ |
et quand je compile le projet il donne les erreurs suivantes :
Code:
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
| c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(24) : error C2629: unexpected 'class RA_Data ('
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(24) : error C2238: unexpected token(s) preceding ';'
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(33) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(33) : error C2501: 'get_Approximations' : missing storage-class or type specifiers
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(34) : error C2061: syntax error : identifier 'Approximations'
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(46) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(46) : error C2501: 'Approximations' : missing storage-class or type specifiers
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(46) : error C2501: 'approx' : missing storage-class or type specifiers
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(138) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(138) : error C2433: 'Approximations' : 'inline' not permitted on data declarations
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(138) : error C2734: 'Approximations' : const object must be initialized if not extern
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(139) : error C2501: 'get_Approximations' : missing storage-class or type specifiers
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(140) : error C2065: 'approx' : undeclared identifier
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(143) : error C2065: 'value' : undeclared identifier
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(143) : error C2597: illegal reference to data member 'RA_Data::Approximations' in a static member function
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(144) : error C2448: '<Unknown>' : function-style initializer appears to be a function definition
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\approximations.cpp(44) : error C2143: syntax error : missing ';' before '&'
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\approximations.cpp(44) : error C2501: 'Approximations' : missing storage-class or type specifiers
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\approximations.cpp(44) : error C2373: 'Approximations' : redefinition; different type modifiers
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\ra_data.h(138) : see declaration of 'Approximations'
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\approximations.cpp(45) : error C2501: '=' : missing storage-class or type specifiers
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\approximations.cpp(45) : error C2556: 'int &__thiscall Approximations::operator =(const class Approximations &)' : overloaded function differs only by return type from 'class Approximat
ions &__thiscall Approximations::operator =(const class Approximations &)'
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\approximations.h(24) : see declaration of '='
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\approximations.cpp(45) : error C2371: '=' : redefinition; different basic types
c:\documents and settings\famille chbihi\bureau\projet c++\kppv\approximations.h(24) : see declaration of '='
Error executing cl.exe.
Approximations.obj - 22 error(s), 0 warning(s) |
et je sais vraiment pas d'où ca vient, j'ai reli mon code mille fois sans rien trouvé
SVP, si quelqu'un peut m'aider je lui serai trés reconnaissant
Merci d'avance
Bien cordialement