Go Down

Topic: control the Build Order (Read 874 times) previous topic - next topic

hole

To make my project more structured I try to divide the parts into multiple TABs inside the Arduino IDE. Current decision is to use a multi file sketch with no extension (so files have the .pde extension).

According to http://www.arduino.cc/en/Hacking/BuildProcess these sketches are concatenated together.

I have problems with variable declarations needed in earlier parts that are merged as later parts (making the compiler unhappy).

I don't really want to switch to .h/.c stuff. Do I have any chance to control the order of this merge process?


PaulS

Quote
I have problems with variable declarations needed in earlier parts that are merged as later parts (making the compiler unhappy).

There is probably no one-size-fits-all answer. Posting some code and error messages will be necessary to solve your issue.

hole

#2
Dec 14, 2010, 04:47 pm Last Edit: Dec 14, 2010, 04:57 pm by hole Reason: 1
Hu, code, really?

In one.pde I have
Code: [Select]
int something;

And in my other.pde I want to do
Code: [Select]
void nana() {
 something++;
}


THis compiles, if  one.pde is merged in front of other.pde. It does not compile, if other.pde is merged in front of one.pde.

I don't want to change the code, I want to control the order or merging.

Addendum: it looks like the merge order is the same as the order of the open tabs. And the open tabs are ordered alphabetically. So I will change my filenames to meet the order I need.

PaulS

Even better would be to include a statement in the appropriate pde file that says that something is defined somewhere else:
Code: [Select]
extern int something;
This tells the current sketch that something is an int, and the the actual space for it is reserved somewhere else.

Then, the order of compiling doesn't matter.

hole

I thought about that.

But than I have to edit at two (or even more) locations, if I change something.

Go Up