New library generating 'No such file or directory' error

Hi,

I’m trying to create a new library that reads a rotating disc with slits in it to determine the speed of a wheel as its spinning. Right now I’m just working on the part that actually senses the high signals input from the light sensor. So far I’ve created the .h file and .cpp files and saved them under the Arduino Library folder but I keep getting the following error which reads “No such file or directory”

So far here is the code that I have for the .h file (saved as Encoder.h):

#ifndef Encoder_h
#define Encoder_h

#include "Arduino.h"

class Encoder
{
  public:
    fclass();
    void setup();
    void loop();
  private:
    int _leftEncoderInputPin;
    int _rightEncoderInputPin;  
};

extern fclass Encoder;

#endif

And here is what I have for the .cpp code

#include "Arduino.h"
#include "Encoder.h"

#define const int leftEncoderInputPin = 48;
#define const int rightEncoderInputPin = 49;

fclass::fclass(){
  
}

void fclass::SETUP(int leftEncoderInputPin);
{
  pinMode(leftEncoderInputPin,INPUT);
  pinMode(rightEncoderInputPin,INPUT);
  digitalRead(leftEncoderInputPin);
  digitalRead(rightEncoderInputPin);
}

void fclass::LOOP() {
  // put your main code here, to run repeatedly:
  leftInput = digitalRead(leftEncoderInputPin);
  rightInput = digitalRead(rightEncoderInputPin);
}

There are multiple weird stuff but what are you doing when you get the error message you mention? Compiling what, with what tools and what’s the exact full error?

I'm using the Arduino IDE to compile the .h and .cpp files by hitting the check mark button. The program is in two separate files, but it's compiling both at the same time. First it goes through the .h file (which is working fine as far as I can tell), then it moves to the .cpp file where it encounters an error. As far as the error goes it just says "exit status 1 Encoder.h: No such file or directory"

(deleted)

asdf_Link:
I'm using the Arduino IDE to compile the .h and .cpp files by hitting the check mark button. The program is in two separate files, but it's compiling both at the same time. First it goes through the .h file (which is working fine as far as I can tell), then it moves to the .cpp file where it encounters an error. As far as the error goes it just says "exit status 1 Encoder.h: No such file or directory"

You're not understanding what a library is. A library is a collection of code that is easy to share between programs. A library is not a complete program and cannot be compiled by itself.

The Arduino IDE won't open libraries, only sketches. A sketch must have at least one file with the .ino extension. The Arduino IDE hides .ino extensions. I believe what you actually have is a file named Encoder.h.ino and a file named Encoder.cpp. In order for the library to work, you need to rename Encoder.h.ino to Encoder.h. Note that Windows likes to hide known file extensions from you by default so if you look at the file in Windows Explorer, it may appear to be named Encoder.h because the .ino is hidden.

After that, you will need to write a sketch that uses the library in a complete program and compile that sketch in the Arduino IDE.