I have a class that will contain all the information for the gyroscope, it is simplified below.
//gyro.h
class Gyroscope {
private:
int port;
Gyro gyroscope
public:
void init()
//all the other functions related to the gyro
};
extern Gyroscope gyro;
//_gyro.cpp
void Gyroscope::init(){
port = 1;
gyroscope = gyroInit(port, 0);
};
Gyroscope gyro;
//init.cpp
gyro.init();
Gyro does not name a type inside the class however it works fine when not initialized in the class. If I can fix this how would I go about doing so?
The linter may have stopped displaying the error, but that doesn’t mean it has been fixed necessarily-- the only way to know for sure would be to compile and test on a robot.
That being said, the code itself looks fine to me.
I already checked and it does work on a robot. The reason I am not using a constructor function is because I simplified the code in this example. In the actual code I am using one.