-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method Declarations before use #59
Comments
Yes it is a known issue. May be I should add a note about it in the readme file. The reason is that, the Arduino IDE, before compiling the files does a pre processing step where it automatically declares all methods. You can check out the code here https://github.com/arduino/Arduino/blob/master/app/src/processing/app/preproc/PdePreprocessor.java#L329 I was actually wondering whether we should do it as well or not. Check #39 and #49 The advantage is that, sketches which work in Arduino IDE will work without any change. The counter argument is that, Arduino IDE does that, so that it is easy for beginners to start with. But makefiles are for people who know what is going on. Adding this feature will bloat it. I actually see merit in both the arguments and have not decided which one to take. But I am open for suggestions as well. |
Are you talking about the "blah is undeclared in this scope" messages? If we're trying to emulate the IDE i guess it should be fixed, but proper C++ requires you to declare your methods before calling them so..... |
Yes.
As I said in the previous commit, I see merit in both the arguments. I am not planning to implement it anytime soon. But if someone is interested in implementing it, then I would be happy to merge it :) |
Anyhow, does exists some CLI preprocessing utility which does the same (or similar) .ino->.cpp conversion, the way PdePreprocessor.java does? Or at least some ready to use script which takes all the functions declarations and put them into simple prototypes? |
Unfortunately to the best of knowledge, the answer is no. Since there wasn't much interest, we decided not to implement it. But your usecase is a valid one. If I come to know of an implementation or if I end up implementing it, then I will let you know about it. |
shouldn't this be closed as its a wontfix ? |
I have marked this and #93 as
Do you still feel that we should close it? |
no i see your point, i guess people wouldn't look through closed tickets for solutions. |
I wrote a preprocessor, because I needed that feature for an App I'm working on. It could be used to create prototypes before using the Makefile. It's written in ruby and is inspired from here. |
Hello, I am wondering if I am missing something. I am using your Makefile and its working great. However, compiling fails unless I declare all of the functions used in the sketch before their use.
Am I missing some easy way around this? While this is just a minor annoyance, a way around this issue would certainly make it easier to use code that was previously written in the Arduino IDE.
The text was updated successfully, but these errors were encountered: