I've been using the same files for a while now, but suddenly making some other changes, this error started popping up
constraints.cpp:105:5: error: use of undeclared identifier 'constraintViolated'; 'constraintViolated' was not declared in scope
What is an 'undeclared identifier' error and how do I fix it?
I followed quite a few answers in the above thread but didn;t seem relevant in my case. I'm not sure if there's something else triggering this. Clearly I've declared the variables in the header but they dont seem to have been read in the cpp file. In fact, there are other variables that do the same,but i'll limit my example to this. The code worked perfectly before, but some minor modifications have made this error pop up. Could it be a build issue?
I've tried to add all the relevant code. The code is below,
constraints.cpp
namespace tudat{
Constraint::Constraint(std::string filenameForConstraintData){
constraintViolated = 0;
constraintLengthVehicle = 0.0;
constraintDiameterVehicle = 2.44;
}
void checkVehicleConstraints(int launchVehicleType, int numberOfStages, double lengthVehicle, double diameterVehicle, Eigen::Vector3d diameterMotorCaseStage,
Eigen::Vector3d diameterNozzleExitStage, Eigen::Vector3d lengthMotorCaseStage){
constraintViolated = 0;
constraintLengthVehicle = 25.0;
constraintDiameterVehicle = 2.44;
if (totalLengthOfTheVehicle/diameterMotorCaseStage1 > maxLOverDRatio){
constraintViolated = 1;
if (printConstraints_ == 1){
std::cout<< "Length is"<< totalLengthOfTheVehicle << std::endl;
}
}
}
constraints.h
namespace tudat
{
class Constraint{
public:
Constraint(std::string filenameForConstraintData);
int getConstraintViolated(){ return constraintViolated; }
// void checkTrajectoryConstraints(const std::vector< tudat::basic_astrodynamics::AccelerationModel3dPointer > listOfAccelerationsActingOnLaunchVehicle,
// const boost::shared_ptr< tudat::RocketLaunchVehicle > launchVehicle,
// const boost::shared_ptr< EnvironmentUpdater > environmentUpdater);
// void checkVehicleConstraints(int launchVehicleType, int numberOfStages, double lengthVehicle, double diameterVehicle,
// double diameterMotorCaseStage1, double diameterMotorCaseStage2, double diameterMotorCaseStage3,// double diameterMotorCaseStage4,
// double diameterNozzleExitStage1,double diameterNozzleExitStage2, double diameterNozzleExitStage3, // double diameterNozzleExitStage4,
/* double vacuumThrustStage1, double massStartStage1, double deltaVVehicle, double vacuumThrfustStage3, */
// double lengthMotorCaseStage1, double lengthMotorCaseStage2, double lengthMotorCaseStage3 ); //, double lengthMotorCaseStage4);
void checkVehicleConstraints(int launchVehicleType, int numberOfStages, double lengthVehicle, double diameterVehicle,
Eigen::Vector3d diameterMotorCaseStage,
Eigen::Vector3d diameterNozzleExitStage,
Eigen::Vector3d lengthMotorCaseStage);
private:
int constraintViolated;
int printConstraints_;