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

Version 2.0 breaks implicit function declaration #1194

Closed
tigoe opened this issue Dec 11, 2015 · 7 comments
Closed

Version 2.0 breaks implicit function declaration #1194

tigoe opened this issue Dec 11, 2015 · 7 comments

Comments

@tigoe
Copy link

tigoe commented Dec 11, 2015

With the latest version, implicit function declaration no longer works, making it incompatible with many existing Arduino sketches.

Implicit function definition is a common pattern in many Arduino sketches on the net, and was an intentional choice in the original Arduino API. Unfortunately, it no longer works in the ESP8266 Arduino port.

In previous versions, this worked:

#include <ESP8266WiFi.h>
void setup() {
}

void loop() {
  myFunction();
}

void myFunction() {
}

Now it produces the error "myFunction was not declared in this scope".

Here's an example that worked with the previous version but fails now, for testing.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@igrr
Copy link
Member

igrr commented Dec 11, 2015

Please see #1066. This seems to be caused by the new arduino-builder getting confused by some c++11 stuff found in standard library headers (memory, functional).

@Protoneer
Copy link
Contributor

Have you tried to move the function up before the setup and loop functions?

On 11/12/2015 6:57 pm, "Ivan Grokhotkov" notifications@github.com wrote:

Please see #1066. This seems to be caused by the new arduino-builder
getting confused by some c++11 stuff found in standard library headers
(memory, functional).


Reply to this email directly or view it on GitHub.

@OzQube
Copy link

OzQube commented Dec 11, 2015

I was getting the same error, and yes, moving the function up does resolve the error for me.

@mangelajo
Copy link
Contributor

Yeah, it's also unable to resolve functions across different .ino files in a project. @igrr, what's the workaround, how does it get confused?

@igrr
Copy link
Member

igrr commented Dec 12, 2015

@mangelajo see some notes in arduino/arduino-builder#68
Workaround is possible for the ESP8266WiFi library, which pulls <vector>. It may be replaced by a linked list.
But for the ESP8266WebServer library, i don't see a workaround. We use function objects there heavily.

@marvinroger
Copy link
Contributor

I think this should not even be an option, as a lot of us are using std::bind (well, I am). so you can't really get rid of <functional> (std::function). We have to wait for the arduino-builder fix.

cottsak pushed a commit to cottsak/opensesameseed that referenced this issue Jan 5, 2016
@devyte
Copy link
Collaborator

devyte commented Oct 19, 2017

I believe this is caused by the Arduino ctags (v5.8). Not much can be done in this repo.
Closing.

@devyte devyte closed this as completed Oct 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants