Serial.println("I can't print this from inside my INCLUDE FILE") h file, it works!įor example, leaving the main sketch file unchanged, if I delete a.cpp and create just a.h (as follows) it works! #ifndef H_A The closest I got to a solution was found here: where, after running my own tests, I determined that if I put EVERYTHING in a. But the idea here is that I want to break out some code and make my sketch more readable. If I put the three files together and have everything in the main sketch (. h file (as I discuss further below), it doesn't help the above example. Actually, it did help the boolean problem but only in the case of putting everything in the. I can see that Errors 2 and 3 are related, but how do I get these in scope? I realise that part of the problem is probably the #include itself (maybe) because Serial and memcpy aren't yet defined/declared? I tried including the the Arduino.h library, but that didn't help. The first problem is the boolean type, seems to suffer from some name mangling that the Arduino environment does, but that is generally fixed by the char foo in the main file. The above, as is, doesn't compile and these are the errors I get: In file included from a.cpp:1:Ī.h:4: error: 'boolean' does not name a typeĪ.cpp: In function 'int isNegative(int)':Ī.cpp:4: error: 'Serial' was not declared in this scopeĪ.cpp:11: error: 'memcpy' was not declared in this scope Memcpy(ch,"1",1) //doesn't work, memcpy not declared // Err#3 Serial.println("I can't print this from inside my INCLUDE FILE") //Err#2 #include // tried it in desperation, no help Main sketch file: char foo // required to clean up some other problems
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |