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

Arduino IDE preprocessor causes unknown type references from prototype creation #2304

Closed
JeffBobbo opened this issue Sep 13, 2014 · 3 comments
Assignees
Labels
Component: Compilation Related to compilation of Arduino sketches Component: IDE The Arduino IDE Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation Type: Bug
Milestone

Comments

@JeffBobbo
Copy link

Functions using/returned an object, structs or using typedefs cause bad code to be fed to the compiler:

Source code:
http://0bin.net/paste/Xz5MZdbmuafYUQ2Q#567rrlhZy8-xCaiI7geiRXEZ+DFo92e4dpZ/cAJvJ3j

Arduino preprocessed code (fed to avr-g++):
http://0bin.net/paste/JgtLxMb23ZOaGJMu#RYZv9sCkcSXeapn0XXRCKphshFH38YLSHmGmn2Iy4EL

@matthijskooijman
Copy link
Collaborator

This is a bit of a known and hard-to-fix problem. I guess the most effective way to fix this would be to stop preprocessing sources. This is related to #992 an #386.

For now, you can fix this by manually specifying a protype, which should prevent the IDE from adding another one.

@ffissore
Copy link
Contributor

We've just posted a new preprocessor version at https://groups.google.com/a/arduino.cc/d/msg/developers/4X2T3rCxXWM/WbQ2_dGzuhsJ
While it does not solve your issue, at least it allows you to work around it by specifying the prototype your self. Try adding a Foo makeFoo(); at line 21: the sketch will compile fine.

@ffissore ffissore self-assigned this Feb 11, 2015
@ffissore ffissore added the Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation label Apr 27, 2015
@ffissore
Copy link
Contributor

Fixed by #3779

@ffissore ffissore added this to the Release 1.6.6 milestone Sep 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Compilation Related to compilation of Arduino sketches Component: IDE The Arduino IDE Component: Preprocessor The Arduino sketch preprocessor converts .ino files into C++ code before compilation Type: Bug
Projects
None yet
Development

No branches or pull requests

3 participants