1

I ran into a strange problem were the compiler could not find a header file that I knew existed.

The problem was I created a class called ArduinoEvent and put it in ArduinoEvent.hpp, but when I tried to include it in a client file, the compiler complained that the file did not exist.

In file included from sketch/NetworkConnection.hpp:4:0,
                 from /home/john/development/arduino/esp_pump_monitor/app.ino:4:
sketch/MyEvent.h:5:28: fatal error: ArduinoEvent.hpp: No such file or directory
 #include "ArduinoEvent.hpp"
                            ^

After realizing that the compiler copies the files into another directory, I took a look and found that it had copied the ArduinoEvent.hpp file to ArduinoEvent.hpp.cpp. Since all the other files were copied fine, I simply renamed the file to BrduinoEvent.hpp and then everything was fine.

After searching I could not find anything that would imply that I could not name a class / file ArduinoBlah, so I was going to open an issue, but wanted to see if this restriction was documented somewhere and I just could not find it.

Update

I originally assumed the problem was due to the file being called ArduinoXxxx, but I hit this again with another file. I think the issue is related to the files being in the "top" folder. I noticed the process copies the xxx.ino files to xxx.ino.cpp, so I think that's what is happening and somehow it thinks various files are .ino files while they are not. As a workaround I moved all my class files to a lib folder and include them from there #include "./lib/xxx.hpp" for example. This seems to be working.

3
  • 1
    A partial answer may be found at: github.com/arduino/Arduino/wiki/Build-Process Commented Jan 1, 2018 at 15:04
  • Try renaming *.hpp*.h. Commented Jan 1, 2018 at 16:39
  • same thing happens, but if I use the name .cpp or even include an empty .cpp file it seems ok Commented Jan 1, 2018 at 18:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.