Error while uploading the code to esp32

Arduino: 1.8.13 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

In file included from C:\Users\Roston Mascarenhas\Desktop\rtnp1\rtnp1.ino:1:0:

C:\Users\Roston Mascarenhas\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:64:24: error: conflicting declaration 'typedef int8_t prog_int8_t'

     typedef int8_t prog_int8_t;

                    ^

In file included from C:\Users\Roston Mascarenhas\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc3\cores\esp32/WString.h:29:0,

             from C:\Users\Roston Mascarenhas\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc3\cores\esp32/Arduino.h:146,

             from sketch\rtnp1.ino.cpp:1:

C:\Users\Roston Mascarenhas\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc3\cores\esp32/pgmspace.h:25:14: note: previous declaration as 'typedef char prog_int8_t'

typedef char prog_int8_t;

          ^

In file included from C:\Users\Roston Mascarenhas\Desktop\rtnp1\rtnp1.ino:1:0:

C:\Users\Roston Mascarenhas\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:68:25: error: conflicting declaration 'typedef int32_t prog_int32_t'

     typedef int32_t prog_int32_t;

                     ^

In file included from C:\Users\Roston Mascarenhas\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc3\cores\esp32/WString.h:29:0,

             from C:\Users\Roston Mascarenhas\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc3\cores\esp32/Arduino.h:146,

             from sketch\rtnp1.ino.cpp:1:

C:\Users\Roston Mascarenhas\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc3\cores\esp32/pgmspace.h:29:14: note: previous declaration as 'typedef long int prog_int32_t'

typedef long prog_int32_t;

          ^

In file included from C:\Users\Roston Mascarenhas\Desktop\rtnp1\rtnp1.ino:1:0:

C:\Users\Roston Mascarenhas\Documents\Arduino\libraries\MPU6050/MPU6050_6Axis_MotionApps20.h:69:26: error: conflicting declaration 'typedef uint32_t prog_uint32_t'

     typedef uint32_t prog_uint32_t;

                      ^

In file included from C:\Users\Roston Mascarenhas\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc3\cores\esp32/WString.h:29:0,

             from C:\Users\Roston Mascarenhas\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc3\cores\esp32/Arduino.h:146,

             from sketch\rtnp1.ino.cpp:1:

C:\Users\Roston Mascarenhas\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc3\cores\esp32/pgmspace.h:30:23: note: previous declaration as 'typedef long unsigned int prog_uint32_t'

typedef unsigned long prog_uint32_t;

                   ^

exit status 1

Error compiling for board ESP32 Dev Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Which libraries should I include to avoid this error

Code which I used

#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"

#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#include "Wire.h"
#endif

MPU6050 mpu;

// MPU control/status vars
bool dmpReady = false; // set true if DMP init was successful
uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU
uint8_t devStatus; // return status after each device operation (0 = success, !0 = error)
uint16_t packetSize; // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount; // count of all bytes currently in FIFO
uint8_t fifoBuffer[64]; // FIFO storage buffer

// orientation/motion vars
Quaternion q; // [w, x, y, z] quaternion container
VectorFloat gravity; // [x, y, z] gravity vector
float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector

volatile bool mpuInterrupt = false; // indicates whether MPU interrupt pin has gone high
void dmpDataReady()
{
mpuInterrupt = true;
}

void setup()
{
// join I2C bus (I2Cdev library doesn't do this automatically)
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
Wire.begin();
TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
Fastwire::setup(400, true);
#endif

mpu.initialize();
Serial.begin(9600);
devStatus = mpu.dmpInitialize();

// supply your own gyro offsets here, scaled for min sensitivity
mpu.setXGyroOffset(220);
mpu.setYGyroOffset(76);
mpu.setZGyroOffset(-85);
mpu.setZAccelOffset(1788); // 1688 factory default for my test chip

// make sure it worked (returns 0 if so)
if (devStatus == 0)
{
// turn on the DMP, now that it's ready
mpu.setDMPEnabled(true);

// enable Arduino interrupt detection
attachInterrupt(0, dmpDataReady, RISING);
mpuIntStatus = mpu.getIntStatus();

// set our DMP Ready flag so the main loop() function knows it's okay to use it
dmpReady = true;

// get expected DMP packet size for later comparison
packetSize = mpu.dmpGetFIFOPacketSize();

}
else
{
// ERROR!
// 1 = initial memory load failed
// 2 = DMP configuration updates failed
// (if it's going to break, usually the code will be 1)
Serial.print(F("DMP Initialization failed (code "));
Serial.print(devStatus);
Serial.println(F(")"));
}
}

void loop()
{
// if programming failed, don't try to do anything
if (!dmpReady) return;

// wait for MPU interrupt or extra packet(s) available
while (!mpuInterrupt && fifoCount < packetSize);

// reset interrupt flag and get INT_STATUS byte
mpuInterrupt = false;
mpuIntStatus = mpu.getIntStatus();

// get current FIFO count
fifoCount = mpu.getFIFOCount();

// check for overflow (this should never happen unless our code is too inefficient)
if ((mpuIntStatus & 0x10) || fifoCount == 1024)
{
// reset so we can continue cleanly
mpu.resetFIFO();
Serial.println(F("FIFO overflow!"));

// otherwise, check for DMP data ready interrupt (this should happen frequently)
}
else if (mpuIntStatus & 0x02)
{
// wait for correct available data length, should be a VERY short wait
while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount();
// read a packet from FIFO
mpu.getFIFOBytes(fifoBuffer, packetSize);
// track FIFO count here in case there is > 1 packet available
// (this lets us immediately read more without waiting for an interrupt)
fifoCount -= packetSize;

mpu.dmpGetQuaternion(&q, fifoBuffer);
mpu.dmpGetGravity(&gravity, &q);
mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
Serial.print("Yaw: ");
Serial.println(ypr[0] * 180/M_PI);
Serial.print("Pitch: ");
Serial.println(ypr[1] * 180/M_PI);
Serial.print("Roll: ");
Serial.println(ypr[2] * 180/M_PI);

}
}

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.