0

I have this code with codeblocks, is a c++ code:


#define ROOT2 1.4142135623730950488
#define PI    3.1415926535897932385

typedef double MATELEMS;
typedef MATELEMS *vector;

typedef int INTELEMS;
typedef INTELEMS *intvector;

vector  *dtm,       // dtm height values [m]
        *stslope,   // matrix with steepest descent local slope [rad]
        *crrain,    // matrix with critical steady state rainfall for landsliding [m/d]
        *camf,      // matrix with number of contributing draining cells, multiple flow [-]
        *casd,      // matrix with number of contributing draining cells, steepest descent [-]
        *T_fac,     // matrix with transmissivity [m/d] values
        *C_fac,     // matrix with combined cohesion [-] values
        *Cs_fac,    // matrix with soil cohesion [kPa] values
        *bulkd,     // matrix with bulk density values [g/cm3]
        *intfr,     // matrix with angle of internal friction values [rad]
        *reserv,
        *ero_slid,
        *cel_dist,
        *sed_slid,
        *sed_bud,
        *sink_sed,
        *olddem,
        *dh_slid;

intvector   *neigh_b,   // 0 or 1 to check neighbours
            *error_m,   // To store error locations as integer
            *sinkmap,
            *slidemap,
            *lumap;   // integer numbers for soil map

int num_out,numfile,ps_flat,spill,num_str,NRO,NCO,
    flat, low, high, dh_nul, sink, top,round,s_ch,
    nr,nc, S1_error,S2_error,sinkchec, looptel,
    row,col,i,j,er_ifile,result,scan_int,numtel,
    xrow,xcol,xxrow,xxcol,
    nb_ok,direct,lock,
    intmax,intmin,intcoun,intout; 

*and CodeBlock give me this kind of error: " error: 'int round' redeclared as different kind of symbol"

and I don't know what that means, i don't understand where is declared previously int round...*

Mat
  • 202,337
  • 40
  • 393
  • 406
  • it is not redeclared in the code you posted. Please post a [mcve] of your code and the complete error message – 463035818_is_not_an_ai Feb 16 '21 at 13:32
  • 3
    oh well, I bet on `using namespace std;` being the troublemaker here – 463035818_is_not_an_ai Feb 16 '21 at 13:32
  • If you get rid of `using namespace std;`, and explicitly use `std::` to reference all classes and templates in the C++ library, your error message will go away. Afterwards, it will be a good idea to completely forget that `using namespace std;` is a part of C++, in order to avoid this kind of confusion in the future. – Sam Varshavchik Feb 16 '21 at 13:34
  • we'd need to see a [mcve] or the complete error message, but I am almost sure that it is this: [Why is “using namespace std;” considered bad practice?](https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice) – 463035818_is_not_an_ai Feb 16 '21 at 13:34
  • @SamVarshavchik and in detail how i can insert "std::"? I'm a beginner with C++ – marzinello Feb 16 '21 at 14:01
  • a) remove `using namespace std;` b) compile to get a list of compiler errors along the line of "xy is not known" c) replace any occurence of `xy` with `std::xy` d) reconsider if you want to continue with `using namespace std;`. Alternative c) use the not so dangerous `using std::vector;` to introduce only the names you actually want to use – 463035818_is_not_an_ai Feb 16 '21 at 14:20

0 Answers0