Passing a pointer-to-struct to a function produces compile error [imported] #188
Labels
Component: Preprocessor
The Arduino sketch preprocessor converts .ino files into C++ code before compilation
Milestone
This is Issue 188 moved from a Google Code project.
Added by 2010-01-19T10:48:06.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium, Component-PreProcessor
Original description
To reproduce the problem please try to compile the code below
I would expect this code to print "bar.a: 10", however I get a compile time
error "Error: variable or field dostuff declared void"
I am using the Arduino 0017 IDE on Windows XP SP3.
While digging around online, certain that I has some error in my use of
pointers or of my understanding of struct I found this thread in the forum:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1195036223
It suggests that my code is fine, it is the auto-generation of prototypes
by the Arduino IDE that is the problem.
It gives three workarounds:
I could not get this one to work but others in the forum say it did for them.
Using this method the code above becomes:
This code works as expected for me. A note on the struct page
(http://www.arduino.cc/playground/Code/Struct) for the workaround would be
nice, but fixing the problem would be better ;)
Thanks!
The text was updated successfully, but these errors were encountered: