添加头文件引用就会报错
代码:仅添加头文件
#include"MPU6050.h"
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
报错结果:In file included from D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_9Axis_MotionApps41.cpp:36:0:
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_9Axis_MotionApps41.h:124:7: error: 'prog_uchar' does not name a type; did you mean 'getchar'?
const prog_uchar dmpMemory[MPU6050_DMP_CODE_SIZE] PROGMEM = {
^
getchar
In file included from D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.cpp:42:0:
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:46:57: error: expected class-name before '{' token
class MPU6050_6Axis_MotionApps612 : public MPU6050_Base {
^
In file included from D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.cpp:42:0:
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:81:29: error: 'VectorInt16' has not been declared
uint8_t dmpGetAccel(VectorInt16 v, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:81:17: error: 'uint8_t MPU6050_6Axis_MotionApps612::dmpGetAccel(int*, const uint8_t*)' cannot be overloaded
uint8_t dmpGetAccel(VectorInt16 v, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:80:17: error: with 'uint8_t MPU6050_6Axis_MotionApps612::dmpGetAccel(int16_t*, const uint8_t*)'
uint8_t dmpGetAccel(int16_t data, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:84:34: error: 'Quaternion' has not been declared
uint8_t dmpGetQuaternion(Quaternion q, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:84:17: error: 'uint8_t MPU6050_6Axis_MotionApps612::dmpGetQuaternion(int*, const uint8_t*)' cannot be overloaded
uint8_t dmpGetQuaternion(Quaternion q, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:83:17: error: with 'uint8_t MPU6050_6Axis_MotionApps612::dmpGetQuaternion(int16_t*, const uint8_t*)'
uint8_t dmpGetQuaternion(int16_t data, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:87:39: error: 'Quaternion' has not been declared
uint8_t dmpGet6AxisQuaternion(Quaternion q, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:87:17: error: 'uint8_t MPU6050_6Axis_MotionApps612::dmpGet6AxisQuaternion(int*, const uint8_t*)' cannot be overloaded
uint8_t dmpGet6AxisQuaternion(Quaternion q, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:86:17: error: with 'uint8_t MPU6050_6Axis_MotionApps612::dmpGet6AxisQuaternion(int16_t*, const uint8_t*)'
uint8_t dmpGet6AxisQuaternion(int16_t data, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:90:42: error: 'Quaternion' has not been declared
uint8_t dmpGetRelativeQuaternion(Quaternion data, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:90:17: error: 'uint8_t MPU6050_6Axis_MotionApps612::dmpGetRelativeQuaternion(int*, const uint8_t*)' cannot be overloaded
uint8_t dmpGetRelativeQuaternion(Quaternion data, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:89:17: error: with 'uint8_t MPU6050_6Axis_MotionApps612::dmpGetRelativeQuaternion(int16_t*, const uint8_t*)'
uint8_t dmpGetRelativeQuaternion(int16_t data, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:93:28: error: 'VectorInt16' has not been declared
uint8_t dmpGetGyro(VectorInt16 v, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:93:17: error: 'uint8_t MPU6050_6Axis_MotionApps612::dmpGetGyro(int*, const uint8_t*)' cannot be overloaded
uint8_t dmpGetGyro(VectorInt16 v, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:92:17: error: with 'uint8_t MPU6050_6Axis_MotionApps612::dmpGetGyro(int16_t*, const uint8_t*)'
uint8_t dmpGetGyro(int16_t data, const uint8_t packet=0);
^
D:\Program Files (x86)\Arduino\libraries\MPU6050\MPU6050_6Axis_MotionApps612.h:97:35: error: 'VectorInt16' has not been declared
uint8_t dmpGetLinearAccel(VectorInt16 v, const uint8_t packet=0);
^
dmpGetFIFOPacketSize
exit status 1
为开发板 Arduino Uno 编译时出错。
试着更换过MPU6050库,但是没有效果
知道原因并解决问题