Unable to create .h for .cpp file

Hi. I added a PID.cpp file according to /en/Hacking/BuildProcess (stupid forum won't let me post this URL)

and that seems fine. However, when I try to use the same process to add the corresponding PID.h file, I get this error message: "A file named 'PID.cpp' already exists in "/path/to/home/Documents/Arduino/MyProject".

While that is true, there is no .h file of the same name.

What am I doing wrong? I want to define a CPP class and use it in the rest of my project, without inlining everything.

Are you able to create the .h file a text editor other than the Arduino IDE? Generally, the Arduino IDE expects you to create the .h file first, then the .cpp file.

I can create the file in that directory, but it wasn't obvious how to open it i a tab in the arduino IDE. Quitting and re-launching seems to have fixed that issue. Seems like a rather arbitrary limitation to have to create the .h file first, and then the .cpp?

Hmm. I just tried creating a .h first, and then a .cpp (tab), and I get the same problem.

I'm not sure why you can't create either one, in either order. The reason that I suggested that you might need the .h first is that it defines the class, while the .cpp implements it. How can you implement a class you haven't defined?

Well, the compiler must "see" the header file contents before it sees code that references it, in any given translation unit (while compiling). But the order in which the files (files, I should point out, that are empty) are created doesn't matter to the compiler, and shouldn't matter to the IDE. I'm fairly sure this is a bug in the IDE.

I can confirm this bug in 0017 for Windows. I've grown accustomed to creating the .h and .cpp files outside the UI first and then starting the interface.

Thanks, Mitch. Either this bug is new, or hardly anyone uses multiple files in their projects.