问题
I'm trying to use a UTFT library in Arduino. If I work with a single .ino
file and include the library there, everything works fine, like this:
example.ino
#include <UTFT.h>
UTFT myGLCD(QD220A,A2,A1,A5,A4,A3);
...
However, if I create a .cpp
and a .h
file, like this:
example.h
#include <UTFT.h>
example.cpp
#include "example.h"
UTFT myGLCD(QD220A,A2,A1,A5,A4,A3);
...
I get an error: UTFT does not mean a type
If I copy the whole TFT library to the project directory, and use #include "UTFT.h"
in the example.h
instead, the error is dismissed.
Why does this happen and how can I fix it?
回答1:
That's some of the magic of the Arduino IDE.
Are you using 1.0.6
or the beta 1.5.X
?
Those kind of issues are being discussed on the google group and should be fixed in a near future.
In the meantime, you can give a try to the Bare Arduino Project.
The idea is to move away from the IDE, organise your project as you wish and use your favorite text editor such as vim or sublimetext with code completion and error checking.
If you have any issue using it, feel free to fill out an issue on Github ;)
来源:https://stackoverflow.com/questions/27630792/arduino-can-import-library-in-ino-but-not-in-c