Problem with understanding

#include <Joystick.h>

int gearR = 0; // Reverse gear set to pin 0
int gear1 = 1; //All pin numbers are to personal preference and whatever suits the build best
int gear2 = 2;
int gear3 = 3;
int gear4 = 4;
int gear5 = 5;
int gear6 = 6;
int gear7 = 7;

void setup() {

pinMode(gearR, OUTPUT); // Set the gear as an input
digitalWrite(gearR, HIGH); //Set the pin to HIGH or +5 Volts

pinMode(gear1, OUTPUT);
digitalWrite(gear1, HIGH);

pinMode(gear2, OUTPUT);
digitalWrite(gear2, HIGH);

pinMode(gear3, OUTPUT);
digitalWrite(gear3, HIGH);

pinMode(gear4, OUTPUT);
digitalWrite(gear4, HIGH);

pinMode(gear5, OUTPUT);
digitalWrite(gear5, HIGH);

pinMode(gear6, OUTPUT);
digitalWrite(gear6, HIGH);

pinMode(gear7, OUTPUT);
digitalWrite(gear7, HIGH);

pinMode(A3, INPUT);
pinMode(A0, INPUT);

pinMode(8, OUTPUT);
pinMode(10, OUTPUT);
pinMode(14, OUTPUT);
pinMode(16, OUTPUT);
digitalWrite(8, HIGH); 
digitalWrite(10, HIGH);
digitalWrite(14, HIGH); //These are required if your chipset
digitalWrite(16, HIGH); //Doesn't have a +5V output pin

Joystick.begin(); //Not needed with Teensy
}

void loop() {

if (digitalRead(gearR) == 0) // gear engaged (the '0' means the pin has been shorted to the ground, causing a drop in voltage on that pin)
{
Joystick.setButton(0, 1); //Button number 0 is set to 1 or active state, Arduino
//Joystick.button(0, 1); //Button number 0 is set to 1 or active state, Teensy
}

if (digitalRead(gearR) == 1) //gear disengaged (the '1' means the pin is no longer shorted to the ground, which increases voltage on that pin)
{
Joystick.setButton(0, 0); //tells the PC to let go of the key (otherwise, it would continue to hold it forever, even after another gear is selected)
//Joystick.button(0, 0); //Button number 0 is set to 0 or inactive state, Teensy
}

if (digitalRead(gear1) == 0)
{
Joystick.setButton(1, 1);
}

if (digitalRead(gear1) == 1) //gear disengaged
{
Joystick.setButton(1, 0);
}


if (digitalRead(gear2) == 0)
{
Joystick.setButton(2, 1);
}

if (digitalRead(gear2) == 1) //gear disengaged
{
Joystick.setButton(2, 0);
}


if (digitalRead(gear3) == 0)
{
Joystick.setButton(3, 1);
}

if (digitalRead(gear3) == 1) //gear disengaged
{
Joystick.setButton(3, 0);
}


if (digitalRead(gear4) == 0)
{
Joystick.setButton(4, 1);
}

if (digitalRead(gear4) == 1) //gear disengaged
{
Joystick.setButton(4, 0);
}


if (digitalRead(gear5) == 0)
{
Joystick.setButton(5, 1);
}

if (digitalRead(gear5) == 1) //gear disengaged
{
Joystick.setButton(5, 0);
}


if (digitalRead(gear6) == 0)
{
Joystick.setButton(6, 1);
}

if (digitalRead(gear6) == 1) //gear disengaged
{
Joystick.setButton(6, 0);
}


if (digitalRead(gear7) == 0)
{
Joystick.setButton(7, 1);
}

if (digitalRead(gear7) == 1) //gear disengaged
{
Joystick.setButton(7, 0);
}

// if (digitalRead(handBrake) == 0) //handbrake engaged //Use these if you have a digital handbrake
// {
// Joystick.setButton(8, 1);
// }

/*if (digitalRead(handBrake) == 1) //handbrake disengaged //Use these if you have a digital handbrake
{
Joystick.setButton(8, 0);
}*/

if (digitalRead(10)==0) //This checks the state of the handbrake mode switch, this is analog //mode
{
//Serial.print("Handbrake raw: "); //These three lines
//Serial.print(analogRead(A0)); //are used
//Serial.print("\t"); //for debugging
if (analogRead(A0)>=1019)
{
Joystick.setThrottle(0);
//Joystick.X(0)); //Teensy analog axis X
}
if (analogRead(A0)<1019)
{
int HBval = (-2.125*analogRead(A0))+2150; //This is unique to your build and you'll have to calculate it yourself
if (HBval < 0) HBval = 0;
if (HBval > 255) HBval = 255;
Joystick.setThrottle(HBval);
//Joystick.X(analogRead(A0)); //Teensy analog axis X
// Serial.print("Handbrake: "); //Debug
//Serial.println(HBval); //lines
}
}

if (digitalRead(8)==0)//This checks the state of the handbrake mode switch, this is digital mode
{ 
if (analogRead(A0)>=1019)
{
Joystick.setThrottle(0);
Joystick.setButton(8, 0);
}
if (analogRead(A0)<900)
{
Joystick.setButton(8, 1);
}
}


if (analogRead(A3)>=1019)
{
Joystick.setRudder(0);
//Joystick.Y(analogRead(A0)); //Teensy analog axis Y
}
if (analogRead(A3)<1019)
{
//Serial.print("Clutch raw: ");
// Serial.print(analogRead(A3));
// Serial.print("\t");
int Cval = -0.3706395349*analogRead(A3)+344.3386628; //This is unique to your build and you'll have to calculate it yourself
//Serial.print("Clutch: ");

if (Cval < 0) Cval = 0;
if (Cval > 255) Cval = 255;
//Serial.println(Cval);
Joystick.setRudder(Cval);
//Joystick.Y(analogRead(A0)); //Teensy analog axis Y
}
}

i get message

Arduino:1.8.3 (Windows 10), Ploča: "Arduino Leonardo"

C:\Users\ivan\Desktop\Joystick\Joystick.ino: In function 'void setup()':

Joystick:50: error: 'Joystick' was not declared in this scope

 Joystick.begin(); //Not needed with Teensy

 ^

C:\Users\ivan\Desktop\Joystick\Joystick.ino: In function 'void loop()':

Joystick:57: error: 'Joystick' was not declared in this scope

 Joystick.setButton(0, 1); //Button number 0 is set to 1 or active state, Arduino

 ^

Joystick:63: error: 'Joystick' was not declared in this scope

 Joystick.setButton(0, 0); //tells the PC to let go of the key (otherwise, it would continue to hold it forever, even after another gear is selected)

 ^

Joystick:69: error: 'Joystick' was not declared in this scope

 Joystick.setButton(1, 1);

 ^

Joystick:74: error: 'Joystick' was not declared in this scope

 Joystick.setButton(1, 0);

 ^

Joystick:80: error: 'Joystick' was not declared in this scope

 Joystick.setButton(2, 1);

 ^

Joystick:85: error: 'Joystick' was not declared in this scope

 Joystick.setButton(2, 0);

 ^

Joystick:91: error: 'Joystick' was not declared in this scope

 Joystick.setButton(3, 1);

 ^

Joystick:96: error: 'Joystick' was not declared in this scope

 Joystick.setButton(3, 0);

 ^

Joystick:102: error: 'Joystick' was not declared in this scope

 Joystick.setButton(4, 1);

 ^

Joystick:107: error: 'Joystick' was not declared in this scope

 Joystick.setButton(4, 0);

 ^

Joystick:113: error: 'Joystick' was not declared in this scope

 Joystick.setButton(5, 1);

 ^

Joystick:118: error: 'Joystick' was not declared in this scope

 Joystick.setButton(5, 0);

 ^

Joystick:124: error: 'Joystick' was not declared in this scope

 Joystick.setButton(6, 1);

 ^

Joystick:129: error: 'Joystick' was not declared in this scope

 Joystick.setButton(6, 0);

 ^

Joystick:135: error: 'Joystick' was not declared in this scope

 Joystick.setButton(7, 1);

 ^

Joystick:140: error: 'Joystick' was not declared in this scope

 Joystick.setButton(7, 0);

 ^

Joystick:160: error: 'Joystick' was not declared in this scope

 Joystick.setThrottle(0);

 ^

Joystick:168: error: 'Joystick' was not declared in this scope

 Joystick.setThrottle(HBval);

 ^

Joystick:179: error: 'Joystick' was not declared in this scope

 Joystick.setThrottle(0);

 ^

Joystick:184: error: 'Joystick' was not declared in this scope

 Joystick.setButton(8, 1);

 ^

Joystick:191: error: 'Joystick' was not declared in this scope

 Joystick.setRudder(0);

 ^

Joystick:205: error: 'Joystick' was not declared in this scope

 Joystick.setRudder(Cval);

 ^

exit status 1
'Joystick' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Hi ivan, where did you install the Joystick library?

.

you never create a Joystick object...

look at some examples of the library and look for the version of the constructor that may look something like:

Joystick myJoystick(some values);

before setup();

I install it at documents

Are you using this library: GitHub - MHeironimus/ArduinoJoystickLibrary: An Arduino library that adds one or more joysticks to the list of HID devices an Arduino Leonardo or Arduino Micro can support.?
If so, you need to create a joystick instance:

Joystick_ Joystick;

yes just found out that was the problem