Compile errors by .ino into .cpp expansion when using macro's and namespaces


hi

i have encountered problem way arduino ide expands .ino file .cpp file (temp folder). includes arduino.h , tries forward declare methods have in .ino.

here's such expansion empty sketch.
code: [select]

#line 1 "myproject.ino"
#include "arduino.h"
void setup();
void loop();
#line 14
void setup() {
                                          
}

void loop() {

}


i have found 2 scenario's breaks down , causes compile errors (syntax).

1) when have function in sketch returns type declared in namespace. code inserted before 'using namespace mynamespace' - forward declaration uses (return) type can not located. qualifying type not work namespace info not copied forward decls.

2) using macro in function declaration copies on macro. have macros declare method. 2 macro's used 'begin' (method name , opening bracket) , 'end' macro (closing bracket). 'end' macro (but not begin macro) copied forward decls resulting in syntax error.

so more intelligence must go retrieving forward decls information...  :)

hope helps,
marc

running:
arduino ide 1.6.5
windows 8.1

i think if put in own forward declarations ide not insert own you.  that should work case 1.  i don't know if works case 2.


Arduino Forum > Using Arduino > Installation & Troubleshooting > Compile errors by .ino into .cpp expansion when using macro's and namespaces


arduino

Comments