#include "Debug.hpp". How to get my code to find this?

I want to include debug.hpp in my code by using #include "Debug.hpp" I have the debug.hpp source code. I suppose I have to copy it into some specific (Arduino) file so the IDE can access it. Would someone walk me thru this process? Thanx.


See if this helps.

RV mineirin

Just put the .hpp file in the same directory as the .ino file
(should be in your documents/Arduino folder, with the same name as the sketch.)

Note that #include is at least theoretically case-sensitive, so don't call it "debug.hpp" in one place and "Debug.hpp" somewhere else.

This doesnt touch my question. Perhaps you should have opened another topic yourself...?

Westfw got it right. Putting the file in the library folder was the key. I had to copy the file as a text file, then rename its extension as hpp. There were several declarations that I had to insert in my code so that Debug.hpp worked properly. I have/had no idea why these statements were required, but an example code that demonstrated the use of Debug.hpp had those statements up front, so they got copied, and then things worked. I found GitHub hard to use as I am an occasional Arduino user. There was an icon to click that said "copied". But copied where? As far as I was concerned, the file got copied to the far side of the moon. So I gave up on that approach and did the TXT copy.

Ah; you hadn't mentioned github.

When you're looking at a file on github, you can right-click on the "raw" button in the upper right (-ish) of the page, and 'save as" to save the file in the original format. Assuming that you didn't want the entire repository, which can be downloaded as a .zip file on the "top" page for the repository.

Many thanx again to westfw. On the specific GitHub page of files containing Debug.hpp, there was no "raw" button, but on other archive pages, Ive seen and used the "raw" button. Instead, when Debug.hpp was selected (highlighted), I clicked on a "code" button which featured a download symbol. Clicking on that gave me the option of downloading a zip file. Im thinking that if I go to the Arduino IDE, I can use the "include library" option and select "add ZIP files". THAT should work, and it would have saved me tons of frustrating time going the route that I went. I havent actually done the final step of "add ZIP files" as I dont want to screw up that which now seems to work. One question (or 2). I put a renamed TXT file in the library folder which the IDE was OK with. The ZIP file has Debug.hpp as a c/c++ header file, but there is no source (TXT) file. It appears the IDE doesnt care if the file is a header or a source...? A website advised that when a ZIP file is downloaded from GitHub, that the IDE will not tolerate certain characters in the name of the ZIP file (numbers and alphabetic only) like underscore (also perhaps dash) and the word "master". So, a rename must be used before the IDE is engaged. What say you?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.