Skip to content
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

Open
sm11963 opened this issue Jun 10, 2013 · 9 comments
Open

Method Declarations before use #59

sm11963 opened this issue Jun 10, 2013 · 9 comments
Labels

Comments

@sm11963
Copy link

sm11963 commented Jun 10, 2013

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.

@sudar
Copy link
Owner

sudar commented Jun 10, 2013

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.

@sej7278
Copy link
Collaborator

sej7278 commented Jun 13, 2013

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.....

@sudar
Copy link
Owner

sudar commented Jun 13, 2013

Are you talking about the "blah is undeclared in this scope" messages?

Yes.

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.....

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 :)

@mkocer
Copy link

mkocer commented Jul 29, 2013

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?
I have some bigger project writen in arduino ide and I am looking for some easy way to switch from original IDE to vim, without big editing work on all my files.
I thing this option would be good to address.

@sudar
Copy link
Owner

sudar commented Jul 30, 2013

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.

@sej7278
Copy link
Collaborator

sej7278 commented Feb 1, 2014

shouldn't this be closed as its a wontfix ?

@sudar
Copy link
Owner

sudar commented Feb 2, 2014

shouldn't this be closed as its a wontfix ?

I have marked this and #93 as wontfix, but didn't close it for two reasons

  • If it is closed, then someone else might create another ticket again for the same issue.
  • If someone is still interested in implementing it, then I am open to merge it.

Do you still feel that we should close it?

@sej7278
Copy link
Collaborator

sej7278 commented Feb 2, 2014

no i see your point, i guess people wouldn't look through closed tickets for solutions.

@michaelbaisch
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants