Go Down

Topic: Compiling Uploading multiple files (Read 3178 times) previous topic - next topic

drew345

I am familiar with making an Arduino sketch as an .ino file using the arduino.exe software. Then I can compile and upload that one file to the Arduino.
 But now I have someone else's software that I want to modify a bit, and it is made of multiple files spread over multiple folders. There is a folder of utilities, hardware, data...  There are .ino, .ccp, .h files…
How do you compile many files together ; and or upload many files together? is this still done using the arduino.exe tool?
What is the next step I need to learn for compiling  and uploading multiple files?
Thanks,
Drew

Robin2

You can have several .ino files in your project directory. The Arduino IDE will load them all automatically.

If you have .h and .cpp files you must refer to them with #include

I'm not sure how the compiler finds .h and .cpp files in other directories but I presume it is possible

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

nickgammon

I am familiar with making an Arduino sketch as an .ino file using the arduino.exe software. Then I can compile and upload that one file to the Arduino.
 But now I have someone else's software that I want to modify a bit, and it is made of multiple files spread over multiple folders.
First, get the files you want into one folder. They will appear in the IDE as "tabs". The complete sketch will consist of all the tabs you have. The IDE is not designed to pull in files from multiple folders, except if you make them into libraries.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

drew345

Thank you very much. I noticed each folder only had one .ino file, and when I opened that .ino file in the IDE, all other .h and .ccp files opened up as tabs, as mentioned above.

Hmmm now I see that every .h file has a .ccp file with the same name (SCKAmbient.h nad SCKAmbient.ccp). What are .h and .ccp files and why is there one of each for every name? Or is that just specific to the code I am looking at?

Thank you very much for the guidance. I'll try splitting up my programs into multiple files too next time.

Drew

PaulS

Quote
What are .h and .ccp files and why is there one of each for every name?
The .h file is a header file. It describes what the library can do.

The .cpp file is a source file. It implements what the library can do.

It is possible, though poor practice, to implement the library in the header file. So, there are two files because it is good programming practice to do it that way.


Go Up