Skip to content

Method Declarations before use #59

Open

Description

@sm11963

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.

Activity

  1. sudar commented on Jun 10, 2013

    @sudar
    Owner

    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.

  2. sej7278 commented on Jun 13, 2013

    @sej7278
    Collaborator

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

  3. sudar commented on Jun 13, 2013

    @sudar
    Owner

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

  4. mkocer commented on Jul 29, 2013

    @mkocer

    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.

  5. sudar commented on Jul 30, 2013

    @sudar
    Owner

    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.

  6. sej7278 commented on Feb 1, 2014

    @sej7278
    Collaborator

    shouldn't this be closed as its a wontfix ?

  7. sudar commented on Feb 2, 2014

    @sudar
    Owner

    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?

  8. sej7278 commented on Feb 2, 2014

    @sej7278
    Collaborator

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

  9. michaelbaisch commented on Mar 23, 2015

    @michaelbaisch

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions