Can't compile code with custom library

#ifndef RCCar_h
#define RCCar_h

#include <Arduino.h>
#include <Servo.h>

class RCCar
{
  public:
    RCCar();
    
    void Setup(int motorPin, int servoPin);
    void SetForward(byte data);
  private:
    int _motorPin;
    int _servoPin;
    Servo _motor;
    Servo _servo;
}

#endif
#include "RCCar.h"

RCCar::RCCar()
{
}

void RCCar::Setup(int motorPin, int servoPin)
{
  _motorPin = motorPin;
  _servoPin = servoPin;
  pinMode(_motorPin, OUTPUT);
  pinMode(_servoPin, OUTPUT);
 
}
void RCCar::SetForward(byte data)
{
  
}
#include "RCCar.h"
#include <Servo.h>

RCCar rc;

void setup()
{
  rc.Setup(2, 10);
}

void loop()
{
  rc.SetForward(94);
}

It just doesn’t wanna compile. First compiler complains about Servo _motor.

error: ‘Servo’ does not name a type

Servo _motor;

Second it complains about defining new type in return type (what?).

error: new types may not be defined in a return type

RCCar::RCCar(int motorPin, int servoPin)

I have also tried changing code below since I have no idea how they differ.

#include "RCCar.h"

to

#include <RCCar.h>

What does your sketch look like? Are you including Servo.h in the sketch? You need to.

Another problem with your code. Your constructor is likely to be called before init() has set up the hardware, so the pinMode() calls will prove useless. You need a begin() method where hardware-related stuff is done.

PaulS:
What does your sketch look like? Are you including Servo.h in the sketch? You need to.

Didn’t know that Servo.h had to be included in the sketch too. Anyway it is now and Servo error is gone.

#include "RCCar.h"
#include <Servo.h>

RCCar rc;

void setup()
{
  rc.Setup(2, 10);
}

void loop()
{
  rc.SetForward(94);
}

PaulS:
Another problem with your code. Your constructor is likely to be called before init() has set up the hardware, so the pinMode() calls will prove useless. You need a begin() method where hardware-related stuff is done.

Thank you for pointing it out. Fixed that part as well.

Only thing left is compiler complaining about

RCCar::RCCar()
RCCar.cpp:8: error: new types may not be defined in a return type
RCCar.cpp:8: note: (perhaps a semicolon is missing after the definition of 'RCCar')
RCCar.cpp:8: error: return type specification for constructor invalid

I updated full code in OP

RCCar.cpp:8: note: (perhaps a semicolon is missing after the definition of ‘RCCar’)

Well, the semicolon at the end of the class definition IS missing.

#ifndef RCCar_h
#define RCCar_h

#include <Arduino.h>
#include <Servo.h>

class RCCar
{
  public:
    RCCar();
    
    void Setup(int motorPin, int servoPin);
    void SetForward(byte data);
  private:
    int _motorPin;
    int _servoPin;
    Servo _motor;
    Servo _servo;
}; // <-- You need a semicolon here

#endif