-
-
Notifications
You must be signed in to change notification settings - Fork 803
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
Error compiling .ino files with functions returning certain types #1683
Comments
ivankravets
added a commit
that referenced
this issue
Jun 15, 2018
* hotfix/v3.5.4: Fix preprocessor for Arduino sketch when function returns certain type // Resolve #1683
Please re-test with |
Brilliant - thanks @ivankravets! Compiles without error now. I really appreciate the fast response on this; keep up the amazing work! |
This error still occurs if the #include "Arduino.h"
#include "ArduinoJson.h"
void normalFunction() {
JsonObject &json = jsonFunction();
}
JsonObject &jsonFunction() {
return JsonObject::invalid();
}
void setup() {}
void loop() {} |
Please use CPP instead INO if possible => https://docs.platformio.org/en/latest/faq.html#convert-arduino-file-to-c-manually |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Configuration
Operating system: Windows 10
PlatformIO Version (
platformio --version
): 3.6.0a2Description of problem
When building an .ino file with functions returning reference types, the file is not correctly preprocessed. If the functions are not declared in the order in which they are called, the build fails with "function was not declared in this scope". The same code compiles without error in the Arduino IDE.
Other types of functions are not affected by this and can be declared in any order without breaking anything.
Steps to Reproduce
Actual Results
Expected Results
Project should build successfully.
If problems with PlatformIO Build System:
The content of
platformio.ini
:Source file to reproduce issue:
Additional info
Playing around, with this a bit more, I've discovered that this also affects functions returning a float.
The text was updated successfully, but these errors were encountered: