Use Of #ifdef Not Processed Consistently · Issue #6475 - GitHub

Skip to content Dismiss alert {{ message }} / Arduino Public
  • Notifications You must be signed in to change notification settings
  • Fork 13.3k
  • Star 16.5k
  • Code
  • Issues 323
  • Pull requests 75
  • Discussions
  • Actions
  • Projects
  • Wiki
  • Security

    Uh oh!

    There was an error while loading. Please reload this page.

  • Insights
Additional navigation options Use of #ifdef not processed consistently #6475New issueNew issueClosedClosedUse of #ifdef not processed consistently#6475@TD-er

Description

@TD-erTD-eropened on Sep 1, 2019

I am not really sure if this is something I am lacking in my knowledge of how Arduino does things with generating the .ino.cpp file, or maybe it is a bug. Either way I am having build issues which look like #ifdef statements are not processed like they should (or at least as how I think they should be processed)

For example, in the main project.ino file, I had a forward declaration of a function and a function wrapped in an #ifdef like this:

#ifdef USES_BLYNK // Blynk_get prototype boolean Blynk_get(const String& command, byte controllerIndex,float *data = NULL ); int firstEnabledBlynkController() { return -1; } #endif

This does result in the generated file project.ino.cpp which has the whole list of function forwarde declarations:

void bla1(); #ifdef USES_BLYNK boolean Blynk_get(const String& command, byte controllerIndex,float *data = NULL ); void otherbla(); void otherbla2(); ....

It does not include the #endif in the forward declarations. And thus the build does fail with lots and lots of errors since all other forward declarations are not found for obvious reasons.

If I move this part to a .h file, it all seems to work just fine.

Not sure if it has anything to do with it, but this define is not defined at the call of the compile, but is set dynamically based on other defines in one of the first included .h files.

Metadata

Metadata

Assignees

No one assigned

Labels

No labelsNo labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You can’t perform that action at this time.

Tag » Arduino #ifndef Esp8266