0
votes

I am trying to create this class in C++ but the compiler keeps giving me a syntax error at it's declaration. The global variables are necessary.

This is the error message

include\SInterface.h(36) : error C2061: syntax error : identifier 'SInterfaceClass'

#ifndef __SINTHDR__
#define __SINTHDR__
#include "Global.h"

typedef unsigned int  uint;

typedef struct
{
    float d1;
    float d2;
    float d3;
    float d4;
    float para;
    float mode;
} DeflStruct;

// Simulation Inputs
// ====================================================================
    float SimAcc [3] = {0};
    float SimGyr [3] = {0};
    //
    // More Global floats being defined here
    //
    float SimOutPara    =  0 ;
    float SimOutMode    =  0 ;

class SInterfaceClass {  // line 36
private:
    float ITime;
    float IPrevTime;
    //
    // More floats being defined here
    //
    float Ic1_bf_psi_rate;
    float Ic1_bf_phi_rate;


public:
    SInterfaceClass();
    DeflStruct Output(
                    Vect3   Acc ,
                    Vect3   Gyr ,
                    double  Pre ,
                    Vect3   Vel ,
                    Vect3   Eul ,
                    Vect3   Inc ,
                    Vect3   Pos ,
                    double  Time);

};

#endif 
1
Why are you using typedef struct instead of just struct? - Bartek Banachewicz
Is anything important int Global.h? - zero298
This class is part of an interface that should join a program written in pure C to a Simulink/Matlab simulation model. I was working on that just before this and kind of did it automatically. - Aaron de Windt
So wait, you're compiling in C or C++? C has no classes. - zero298
Post a complete snippet that reproduces this error. As written excluding Global.h happily passes the marked line without error and continues on until the Vect3 members, where are of course not valid because there is no Global.h. - WhozCraig

1 Answers

0
votes

I see two reasons. The first one that this error is the result of some inconsistence in header "Global.h"

The second one is that the compiler compiles your code as C code not as C++ code.