I have a strange question... : I'm trying to compile a large sketch (over 850 lines) with new ide 1.6.4 and I've got 2 different results, depending on where i put the Setup & Loop subroutines.
I the first case I put them at the beginning of sketch, just after globals declarations...
In this case compiler stops giving multiple errors about undefined subroutines.
In the second case I put Setup & Loop at the end of the sketch, after all other subroutines.
In this case compiler creates successfully the file for Arduino Uno without any error... ?
I've supposed, up to now , that IDE would do some preprocessing, including automatically prototyping of subroutines... Isn't it ?
Just to explain better what happened, the first case was my normal configuration of sketches and, up to know, I've compiled all my other (smaller) programs without problems, including also previous versions of the same program that causes all that. Obviously, I dammned a while before understanding that the problem was the Setup & Loop position.
Also, I could'nt find anywhere here in Arduino site, infos about the position of Setup & Loop...
I've attached 2 screenshot of the compile process...
If your sketch is too big, use REPLY rather than QUICK REPLY and it has an attachment facility, so you can post your sketch as an attachment, but try code tags first.
I the first case I put them at the beginning of sketch, just after globals declarations...
In this case compiler stops giving multiple errors about undefined subroutines.
In the second case I put Setup & Loop at the end of the sketch, after all other subroutines.
In this case compiler creates successfully the file for Arduino Uno without any error... ?
Can you just reread the bit above, please.
I think you mean.
I the first case I put them at the beginning of sketch, just after globals declarations...
In this case compiler stops compiling and gives multiple errors about undefined subroutines.
In the second case I put Setup & Loop at the end of the sketch, after all other subroutines.
In this case compiler creates successfully the file for Arduino Uno without any error... ?
Hi TomGeorge 8) & thank You for Your answer,
Yes, of course, the second Code Tag was the correct one... , sorry for my english...
Now to Your question... Really You want to pass 850 lines of code, unknown by You, searching for something wrong ?? We've already done this more & more times and it's not easy...
Moreover the code seems not to be the problem, because, if that where the problem, it would not compile the second time.
After that... not all the code is mine, so before releasing somewhat, I've to speak with my friend before, asking if we could do that
So, let us try if we can put something together to reproduce the problem...
If you try to reduce the code to a much simpler example that exhibits the same problem, you'll almost certainly stumble across the real solution to the problem. Whatever the actual problem is, I can assure you it is not the location of setup() and loop()...
doesn't the error message show that something was called during the set up function that hasn't been defined/declared yet.
somewhere what ever was called could have been used in the program so putting the setup/loop at the end fixs the problem as the compiler reads from top to bottom.
would be interesting to have seen what line 142 was in the code that failed.
AWOL:
. . . POST YOUR CODE. otherwise, you're just wasting everyone's time.
HEY HEY HEY ! What's this rude reply ? Are You a Moderator or an Imperator ?
If You try to understand better my post You will notice that we'we just resolved our problem.
I wrote my post just to let Arduino community know, You included, that maybe there is something that did not work correctly in new IDE 1.6.4.
These type of replys let us say "why should we do that ? Let them with their certainties (? is this therm correct ? I'm not sure... from Google translator) and go ahead with your work"
BUT... because we LIKE this community, WE waste our time, and put toghether 2 example of code that show the problem... They are exactly the same, unless the position of the SETUP routine.
We do our best to check that the codes differs only in SETUP position, now it's up to You to find differences... or, Better... To understand Why...
Just another thing... We've noticed during these tries, that when the compiler fails to compile, the error lines showed by compiler report are wrong, about 10 lines more than the correct one to where the error should refer.
I attach the 2 codes because with code </> tags reply becomes too long...
What's the problem here ? It's a problem for You to download 230Kb of images ? What sort of old ADSL did You have ? Your portable device cannot store temporarily Mbytes of data ? I don't think so... Such devices are no more on sale since, I think, 10 years...
Or Your trouble is that Arduino.cc cannot store such BIG images ??
While, in the meanwhile, Youtube for example, stores GB of data x second ??
So... What's the real problem ??
My intention is to show here that maybe something did not work correctly in IDE, or only in mine. I'm not an expert, so I can't understand what's wrong, and that's why I'm writing here...
There are quite a few experienced people on the forum anxious to help you, and help you get as much as you can out of your Arduino. You can help them do that by making helpful posts:
Make an informative subject description, not "help me, I'm a noob", nor something in all capitals. Try to avoid saying "urgent". That's your problem, not ours.
Describe your problem in detail.
If it relates to an electronics part (chip or board), give the exact part number and preferably a link to the data sheet.
Describe how you have connected things like switches. Are they wired to ground? Or +5V? Are there pull-up or pull-down resistors? Post a circuit if there is doubt.
Post your complete sketch (program code)! If you don't you waste time while people ask you to do that.
When you post your code put it between ... tags. You can do that by hitting the </> button above the posting area.
If you get an error, post the error (copy and paste). Not just "I got an error".
With coding problems, if possible post a "minimal" sketch that demonstrates the problem - not hundreds of lines of code.
If you have debugging information in your sketch, post your debugging displays.
Describe what you expected to happen, and what actually happened. Not just "it doesn't work".
If possible, describe what you are really trying to do, not what you think might work. For example "I am trying to turn on an aquarium heater and pump at the same time", not "how do I break out of an interrupt?".
Don't double-post (cross-post). Your question will be noticed. If you post it in multiple places you will just annoy people who might otherwise have answered.
Just the first one is wrong... "Getting help on the forum" I've just solved my problem...
Where is the point : "can I be helpful to someone here in the forum" ?
As AWOL guessed I meant that by stripping out the large comment blocks I was able to fit the code into a post here, which you could have done. With the code in code tags it is easy to copy/paste it into the IDE, compile it and see what happens. Apart from removing the comment blocks I made no changes so did not expect it to compile. In any case I do not have all the libraries that it uses.