Skip to content

Another Preprocessor error #28

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

Closed
NicoHood opened this issue Oct 3, 2015 · 6 comments
Closed

Another Preprocessor error #28

NicoHood opened this issue Oct 3, 2015 · 6 comments

Comments

@NicoHood
Copy link

NicoHood commented Oct 3, 2015

void setup() {}

void loop() {
  // Visualize leds via Adalight
  int8_t newData = adalight();

}


//#define ADALIGHT_USE_TEMPLATE

#ifdef ADALIGHT_USE_TEMPLATE
#error
int16_t adalight_template()
#else
int8_t adalight()
#endif
{
  // Flag if the leds got a new frame that should be updated
  return 0;
}

/*
 * sketch_oct03d:5: error: 'adalight' was not declared in this scope
   int8_t newData = adalight();
 */

Error in code above, should be self explaining.

@NicoHood
Copy link
Author

NicoHood commented Oct 3, 2015

Another example this the same error. Might be two separat issues, I dont know whats behind the code. So I post it here, pretending its the same reason which causes this:

void setup() {}
void loop() {
  int8_t newData = adalight();
}

//#define ADALIGHT_USE_TEMPLATE

#ifdef ADALIGHT_USE_TEMPLATE
#error
#else
// commenting this header makes the sketch compile
int8_t adalight();
#endif
int8_t adalight()
{
  return 0;
}

@ffissore
Copy link
Contributor

ffissore commented Oct 5, 2015

In your second sketch, int8_t adalight(); is a prototype and you must specify it at the beginning of the sketch

@ffissore ffissore self-assigned this Oct 5, 2015
@ffissore ffissore added the bug label Oct 5, 2015
@ffissore
Copy link
Contributor

ffissore commented Oct 5, 2015

Your first sketch still doesn't compile, unless you rename int16_t adalight_template() to int16_t adalight(). CTags gets fooled by define and it's not even seeing int8_t adalight()

@ffissore
Copy link
Contributor

ffissore commented Oct 5, 2015

More info at http://linux.die.net/man/1/ctags, scroll down to "Operational Details"

@NicoHood
Copy link
Author

NicoHood commented Oct 5, 2015

So this is intended?

@ffissore
Copy link
Contributor

ffissore commented Oct 5, 2015

No, it's a known limitation of ctags. We have to either fix it or get used to it. Maybe this one will help us

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

No branches or pull requests

3 participants