error: redefinition of class

Hi,

I am trying to make this project found on yt work: MPU6050 GY-521 + L298N Arduino R3 + Stepper motor Knob Control - YouTube

But I have a problem, when I’m trying to compile the whole code this error appear everythime:

Arduino: 1.8.8 (Windows 10), Board: "Arduino/Genuino Uno"

Kalman.h:18:7: error: redefinition of 'class Kalman'

 class Kalman {

       ^

In file included from C:\Users\Rares\Documents\Arduino\var2\var2.ino:1:0:

C:\Users\Rares\Documents\Arduino\libraries\libraries\Kalman_Filter_Library/Kalman.h:21:7: error: previous definition of 'class Kalman'

 class Kalman {

       ^

exit status 1
redefinition of 'class Kalman'

The code uses 2 libraryes:
Kalman, from where the error provide and I2C.

I attached the libraries and the main code.

Can anyone help me? Any ideea? Please.

Sorry if I said something wrong, I’m still learning :slight_smile:

Kalman.h.ino (4.34 KB)

I2C.ino.ino (2.36 KB)

var2.ino (7.33 KB)

Some confusion of file types going on I think.

You are not by any chance using Windows with the "hide the file types so that I can't see what is going on" option turned on are you ?

I am not, all files are visible. But how that can that affect my code?

The files may be visible but what about their extensions ? .ino .h etc

Look at the file named Kalman Should it be a .h or a .ino file. My guess is that you have "hide file types" turned on so what you see is Kalman.h whereas its name is really Kalman.h.ino so is an ino file

Yes, you're right. It's Kalman.h.ino. So it's should be just a Kalman.h file?

Don’t put library files in your sketch. You already have the library installed:

rares351:

In file included from C:\Users\Rares\Documents\Arduino\var2\var2.ino:1:0:

C:\Users\Rares\Documents\Arduino\libraries\libraries\Kalman_Filter_Library/Kalman.h:21:7: error: previous definition of ‘class Kalman’

class Kalman {

^

Just delete Kalman.h.ino and I2C.h.ino.

Yess. It works. Thanks a lot !! :money_mouth_face: :smiley:

You're welcome. I'm glad to hear it's working now. Enjoy!
Per