And as I can see, it works and doesn’t show errors iside of the main.cpp file:
But, if I look into the drivePID.cpp file, it have a lot of errors and it won’t allow me to build the project.
It looks like you have identical variables in your main and pid files. Do you have another pid function in your main file that’s double defining variables?
Sorry, I forgot to mention to remove the include ‘drivePID.cpp’
to use the functions from the file you need to make the declaration that the functions exist elsewhere like so before using it: int drivePID();
Also, to use variables between files you need to tell the file to look for the variable elsewhere. This can be done in any of the header files that are included but I put it in robot-config.h since I was too lazy to make a new file. If you want to see how I did it you can look there. (It’s just extern type var;)
I had to play around with your code a bit to figure out what was wrong and I ended up inadvertently fixing it, here is what I had: yeet.zip (18.5 KB)
In general, you shouldn’t #include .cpp files. Instead, you should declare prototypes for functions and objects you need in a .h file, and include that .h file.