I blew out my USB ports on my old mac. So now I'm on a family members new mac. I had to download the newest version 1.6.9 of arduino but was using 1.6.1 at home. I have to use this new one to get everything to work with the teensy...
so...
My code compiled on my old computer just fine. copied it and pasted it into this new IDE and I get
('solidFade' was not declared in this scope)
solidFade is a function written as solidFade(); and exist outside of the void loop as void solidFade(){...}
it says this about all of the functions...
Does anyone have any ideas why this code compiled on 1.6.1 and not 1.6.9?
Are the function defined in the same source file? What happens if you take each function signature and make it a function prototype at the top of the source file?
econjack, thank you that worked. I had to move all of the functions around so that they stacked on top of each other. If a function called another function then the one imbedded needed to go first. very annoying.
all is well now.
Delta_G, you don't want this code. It long and would not help anyway. This is why it was not included. Discussions can happen without code.
after upgrading to 1.6.9, my code has the same issues..
is this a new thing, as in its going to stay in? my 1200 lines of code which was easy to read and understand, now has to go in some higgledipiggledy order so it will compile... which, i guess is fine if you write the code this way... but is a pain for any old code.
rexhex:
econjack, thank you that worked. I had to move all of the functions around so that they stacked on top of each other. If a function called another function then the one imbedded needed to go first. very annoying.
all is well now.
Delta_G, you don't want this code. It long and would not help anyway. This is why it was not included. Discussions can happen without code.
You don't have to move the functions. Only the prototype has to precede the usage. You chose the more awkward of the two choices that Econjack gave you.
I agree. The way it compiles code is not how I learned to write. I hope they change it back to normal compiling.
They are changing it back to normal compiling. I wish they would go back all the way. Unfortunately, it will be viewed as a problem that needs to be fixed. The convenience of not having to provide function prototypes, or being able to use a function before it has been defined, is purely an Arduino feature, and has never been a part of any C/C++ environment that I know of.
But realistically, it is too late, since so much code has been generated that way.
Anyone who is worried about the "clutter" can just stick the function prototypes into a header file and put that at the top of the source file. When you write a new function, just add it to the header file. A little bit of a hassle, but when you consider the IDE is free, it's a small price to pay (...along with the donation you made to the IDE team).
econjack:
Anyone who is worried about the "clutter" can just stick the function prototypes into a header file and put that at the top of the source file. When you write a new function, just add it to the header file. A little bit of a hassle, but when you consider the IDE is free, it's a small price to pay (...along with the donation you made to the IDE team).
+1, It also gives you a "go to" place to read what functions are defined, all in one place without having to hunt through the entire program.
aarg:
They are changing it back to normal compiling. I wish they would go back all the way. Unfortunately, it will be viewed as a problem that needs to be fixed. The convenience of not having to provide function prototypes, or being able to use a function before it has been defined, is purely an Arduino feature, and has never been a part of any C/C++ environment that I know of.
But realistically, it is too late, since so much code has been generated that way.
ok I see what is going on here. I have gotten used to the Arduino version of c. Its all I have been using since I took some classes in school. Unfortunately changing something like this only confuses users but in the long run this is better. The way I view arduino is a platform to get people into programming. Its why I did.. But I have also come to like it the most, maybe its because of why I program..
The closer it goes to traditional c the easier it will be to transition between compilers. At the same time it might make it more challenging for beginners.
econjack:
Are the function defined in the same source file? What happens if you take each function signature and make it a function prototype at the top of the source file?
I read over that quick and missed that I just needed the prototype at the top. Put the whole function up there! also a header file would be much more clean, just have not taken the time to clean any of this 5 month long project up.
Thank you guys for clearing this up for me. I was confused why Arduino would now require all functions at the top. This was also a good reminder to declare prototypes.