Heinz Kessler wrote on Jun 16
th, 2014 at 6:47pm:
@ RayLivingston,
Hi Ray,
my name is Heinz Kessler, I am the author of the Visual Micro documentation.
We would like to make a FAQ or enhance an existing documentation article with your case.
Therefore my question:
What elements (global variables, function declaration...) were dependent of the order of the files?
Did you find a solution that worked for you or did you have to play around with filenames?
Thank you,
Heinz Kessler
visualmicro.com
Heinz,
The annoying thing is, I never seem to be able to find patterns to the wierd behaviors I see with the Arduino tools. I can make some inane change, and suddenly things are borked. In the current case, I split one large sketch into perhaps a half dozen .ino files, and immediately got errors due to some, not all, variables being referenced before they were declared. That prompted me to move the definitions of all variables into the primary .ino file, to ensure they were defined before any code. I then had just one function that was generating a linker error, and I had to add a prototype for that one function to the top of the .ino file. Why only that one function? Damned if I know! But that's been my experience all along with Arduino builds all along - making some silly change over here will break something way over there, with no rhyme or reason.
Oddly, after I got it all to compile, I was able to move most of the data declarations into the files containing most of the code that referencese them, and it still compiles fine. There seems to be a random element to the build. I have also often found weird compile problems can be resolved by doing a clean build, though it's a mystery to me why that should make any difference, given how the build process works.
I think the best thing you could do is EXPLAIN the
goofy Arduino build process, as Tim has done in this thread, so people can understand how it works. It is rather bizarre, and very unconventional. I was actually unable to find an explanation on-line of how the process works. The information Tim gave me was invaluable, and I'm amazed I couldn't find an explanation like that anywhere. Now that I know what it's doing, it shouldn't be hard for me to resolve any further problems that will inevitably crop up.
BTW - One thing that makes fixing these problems more difficult sometimes with VisualMicro is that VisualMicro seems to sometimes not show ALL of the error messages from the compiler. About once a week, I'll get a compiler error, but NO information to point me to the source of the error. I can open the Arduino IDE, and compile the same sketch there, and I will always get the missing information. Perhaps this is a bug with Arduino 1.05, as I've only been using 1.5.6 for a few days now.
Regards,
Ray L.