PROS gyroscope in class

I have a class that will contain all the information for the gyroscope, it is simplified below.

class Gyroscope {
  int port;
  Gyro gyroscope
  void init()
  //all the other functions related to the gyro
extern Gyroscope gyro;

void Gyroscope::init(){
  port = 1;
  gyroscope = gyroInit(port, 0);
Gyroscope gyro;


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?

EDIT: code block formatting

What’s the error? Make sure that you are including all the needed header files (namely


) and all that. I’m doing something similar in my code, which may be of some use to you

All the correct header files were included (in this case


The error was:

'Gyro' does not name a type

However for whatever reason restarting atom fixed it so problem solved?

EDIT: code formatting (I am very bad at this)

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.

(PS: can I ask why you are using


instead of a constructor?)

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.

Glad to hear it- it must have just been a hiccup with the linter.

Ah, that explains it then :slight_smile: