Go Down

Topic: Looking for a location for user-created headers (Read 1 time) previous topic - next topic

Professor Chaos

Why not put them as a separate tab in the IDE?


Jul 09, 2009, 05:40 am Last Edit: Jul 09, 2009, 05:46 am by Kitep Reason: 1
I'm not familiar with tabs and a quick search didn't turn up how to use them.  Could you point me to an instruction page?  Thanks.

Never mind.  I found it: http://www.arduino.cc/en/Hacking/BuildProcess

And the relevant stuff:
Multi-file sketches
A sketch can contain multiple files (tabs). To manage them, click on the right-facing arrow just above the scroll bar near the top of the environment. Tabs have one of four extensions: no extension, .c, .cpp, or .h (if you provide any other extension, the period will be converted to an underscore). When your sketch is compiled, all tabs with no extension are concatenated together to form the "main sketch file". Tabs with .c or .cpp extensions are compiled separately. To use tabs with a .h extension, you need to #include it (using "double quotes" not <angle brackets>).


Jul 17, 2009, 08:02 am Last Edit: Jul 17, 2009, 08:19 am by bitrex Reason: 1
Sorry for the delay in my reply, I had been on vacation for a while.  I've come back to this problem, and unfortunately I still can't get adding files to the sketch to work.  Putting it in my libraries folder as a .h file doesn't work (no such file or directory), and when I select "Add File" from the Sketch menu and select the file I want to add, no tab is added - nothing happens at all.  Any ideas?  

Edit: I have it working now, I found the little arrow button at the far right of the environment (couldn't see it hiding over there!) and created a tab, then pasted in my data.  Unfortunately, I've hit another problem, in that when I declare arrays or variables in this new tab the main sketch file doesn't "see" them when it compiles and I keep getting "not declared in this scope" errors.

Edit again: If I declare the arrays in both the main program and the tab, I get a variable redefinition error...if I declare the arrays just at the top of the main program, everything compiles fine. So it seems like maybe there's some kind of ordering issue with the compiler where it's looking at the main program first and causing an error when it hasn't yet looked at the tab where the variables are defined?  :-?


You have to manually erase the .o file before compiling, or the library won't be recompiled.

Go Up