-1

After to have been aware of the persons who had the same problem than mine, I still get this error :

error C2371: 'ST_ELLIPSE' : redefinition; different basic types
see declaration of 'ST_ELLIPSE'
C2371: 'ST_VECTEURS' : redefinition; different basic types
see declaration of 'ST_VECTEURS'
'ST_ROI' : redefinition; different basic types
see declaration of 'ST_ROI'
'ST_CONVERSION' : redefinition; different basic types
see declaration of 'ST_CONVERSION'
'ST_PARA_VISU' : redefinition; different basic types
see declaration of 'ST_PARA_VISU'

Here is the file:

#define MAX_VAL_VISU        245
#define MAX_VAL_VISU_SUPP   128
#define MAX_VAL_OVR_SUPP    116

#define VISU_SIZE_X         672
#define VISU_SIZE_Y         512
#define DELTA_ZONE          5

#define FLAG_RIEN           1
#define FLAG_ZOOM           2
#define FLAG_DEP            4
#define FLAG_STAT           8
#define FLAG_CONTRASTE      16
#define FLAG_ZONE           32
#define FLAG_OVR_WRITE      64
#define FLAG_OVR_EFF        128
#define FLAG_OVR_TEXTE      256
#define FLAG_ROI            512  // V2.0

// flag de suppression (& avec flag au dessus)
#define FLAG2_RIEN          0  // 0 aucune autres fenetres
#define FLAG2_ZOOM          0
#define FLAG2_DEP           0
#define FLAG2_STAT          FLAG_CONTRASTE
#define FLAG2_CONTRASTE     (FLAG_STAT | FLAG_ZONE | FLAG_ROI)
#define FLAG2_ZONE          FLAG_CONTRASTE
#define FLAG2_OVR_WRITE     (FLAG_ROI | FLAG_CONTRASTE)
#define FLAG2_OVR_EFF       (FLAG_ROI | FLAG_CONTRASTE)
#define FLAG2_OVR_TEXTE     0
#define FLAG2_ROI           FLAG_CONTRASTE 


#define TYPE_MODIF_ZONE_RIEN    0 // pas de modification
#define TYPE_MODIF_ZONE_H       1 // definition de la ligne Haut
#define TYPE_MODIF_ZONE_B       2 // definition de la ligne BAS
#define TYPE_MODIF_ZONE_G       3 // definition de la ligne gauche
#define TYPE_MODIF_ZONE_D       4 // definition de la ligne droite
#define TYPE_MODIF_ZONE_P1      5 // definition du point haut/gauche
#define TYPE_MODIF_ZONE_P2      6 // definition du point bas/droite
#define TYPE_MODIF_ZONE_P3      7 // definition du point bas/gauche
#define TYPE_MODIF_ZONE_P4      8 // definition du point haut/droite

#define LUT_GRAY        0
#define LUT_COLOR1      1
#define LUT_COLOR2      2
#define LUT_FICHIER     3
#define LUT_SUPERPOSITION   4

#define NB_COULEUR 10

#define ROI_ZONE    0
#define NB_ROI      10

#define NB_UNITE    2

// structure
//***********
// V2.0
// ROI
typedef struct 
{
    // données de depart
    double x1[NB_UNITE],y1[NB_UNITE],x2[NB_UNITE],y2[NB_UNITE],d2[NB_UNITE];
    // donnee calculées
    double d1[NB_UNITE];
    double x11,y11,x22,y22; 
    // angle de rotation 
    double angle;
    // origine
    double ox,oy;
    // position foyer
    double fx1,fx2,fy1,fy2,dist;
    // min max en X et en Y
    int x_min,y_min,x_max,y_max;
}ST_ELLIPSE;
typedef struct 
{
    int nb;
    double x[NB_UNITE][10],y[NB_UNITE][10];
}ST_VECTEURS;

#define ROI_RECTANGLE   0
#define CHAR_ROI_RECTANGLE  "R"
#define ROI_ELLIPSE     1
#define CHAR_ROI_ELLIPSE    "E"
#define ROI_VECTEURS    2
#define CHAR_ROI_VECTEURS   "V"

typedef struct{
    bool flag_def_zone;
    int type_roi;
    // rectangle
    double x_zone[NB_UNITE],y_zone[NB_UNITE],dx_zone[NB_UNITE],dy_zone[NB_UNITE];
    // ellipse
    ST_ELLIPSE ellipse;
    // vecteurs
    ST_VECTEURS vecteurs;
}ST_ROI;

// V2.0
#define CONVERSION_ZONE  1  // indice dans ST_CONVERSION
// parametres de conversion pixel ->mm
typedef struct {
    double x_pix,x_mm,y_pix,y_mm;
    double coef_x;
    double coef_y;
    CString unite[2];
}ST_CONVERSION;

// V2.0
// parametres de la visu
typedef struct{
    int x_zoom,y_zoom,m_zoom; // zoom
    ST_ROI roi[NB_ROI]; // roi
    int ind_conversion;
    ST_CONVERSION coef_conversion[2]; // conversion pour stat pix->autre unité
}ST_PARA_VISU;`

Someone would have any ideas ?

Thanks per advance for your help !

Niall
  • 30,036
  • 10
  • 99
  • 142
MichMich229
  • 11
  • 2
  • 4
  • Looks like you forgot your [include guards](http://en.wikipedia.org/wiki/Include_guard) – Mike Seymour Sep 29 '14 at 12:54
  • `#pragma once` is your friend. Put him at the top of each .h file. – Yann Sep 29 '14 at 13:09
  • In C++, you don't need to use `typedef struct`. You can refer to them by their tag name: `struct ST_ROI {...};` – Thomas Matthews Sep 29 '14 at 13:53
  • Thank you for posting the structure definitions. Now, how about adding (edit your post) the code that generates the error. – Thomas Matthews Sep 29 '14 at 13:54
  • @ThomasMatthews You are being funny, if i would know the code where is the error i would not be here asking for help. – MichMich229 Sep 29 '14 at 14:23
  • @MichMich229 in that case, I've posted it as an answer, because around here, we try not to answer in comments. If it worked, hit accept on the answer. As a side-note, have a read of the [how to ask](http://stackoverflow.com/help/how-to-ask), because this question could use some work to be more helpful, and if you follow those guidelines, people will tend to be a bit friendlier and more willing to help, which you need if it's a tricky question. – Yann Sep 29 '14 at 14:41

1 Answers1

2

Putting #pragma once at the top of each .h file is the way to do it if you don't mind using macros, and otherwise, the 'proper' way to do it is

#ifndef AWESOME_H
#define AWESOME_H
class Awesome
{
    //awesome.h contents
};
#endif
Yann
  • 978
  • 2
  • 12
  • 31