Arduino UNO + LSM9DS1 problem

Hi, I have programmed the Arduino Uno with Adafruit LSM9DS1 Accelerometer. Everything was working fine, then I wanted to upload the program again to the board and I got a lot of errors.

#include <Wire.h> // for I2C 
#include <Adafruit_LSM9DS1.h>
#include <Adafruit_sensor.h>
// Magnetometer and accelerometer-giroscope subsystems addresses for i2c
#define LSM9DS1_M D1 
#define LSM9DS1_AG D2

unsigned long tmeas, tlast;
unsigned int delta; 

// Instantiate the IMU
Adafruit_LSM9DS1 imu = Adafruit_LSM9DS1();


void setup() {
  Serial.begin(2000000); 
  imu.settings.device.commInterface = IMU_MODE_I2C;
  imu.settings.device.agAddress = LSM9DS1_AG;
  imu.settings.device.mAddress = LSM9DS1_M;
  imu.settings.gyro.enabled = false;  
  imu.settings.mag.enabled = false;
  imu.settings.temp.enabled = false;
  
  // [scale] sets the full-scale range of the accelerometer.
  // accel scale can be 2, 4, 8, or 16
  imu.settings.accel.scale = 8; 
   // [sampleRate] sets the output data rate (ODR) of the
  // accelerometer. ONLY APPLICABLE WHEN THE GYROSCOPE IS
  // DISABLED! Otherwise accel sample rate = gyro sample rate.
  // accel sample rate can be 1-6
  // 1 = 10 Hz    4 = 238 Hz
  // 2 = 50 Hz    5 = 476 Hz
  // 3 = 119 Hz   6 = 952 Hz
  imu.settings.accel.sampleRate = 6;
   // [bandwidth] sets the anti-aliasing filter bandwidth.
  // Accel cutoff frequeuncy can be any value between -1 - 3. 
  // -1 = bandwidth determined by sample rate
  // 0 = 408 Hz   2 = 105 Hz
  // 1 = 211 Hz   3 = 50 Hz
  imu.settings.accel.bandwidth = 0; 

  imu.settings.accel.highResEnable = true;
   // [highResBandwidth] sets the LP cutoff frequency of
  // the accelerometer if it's in high-res mode.
  // can be any value between 0-3
  // LP cutoff is set to a factor of sample rate ODR output data rate
  // 0 = ODR/50    2 = ODR/9
  // 1 = ODR/100   3 = ODR/400
  imu.settings.accel.highResBandwidth = 0; 
  
do {
  // Serial.println("Failed to communicate with LSM9DS1.");
  ;
  } while (!imu.begin());
  
  tlast = micros();
}

void loop() {
  if ( imu.accelAvailable() ){
  imu.readAccel(); 
  tmeas = micros();
  delta = tmeas -tlast;
  tlast = tmeas;
  // 16 bit signed integers -32768 to 32767
  Serial.print(imu.ax);
  Serial.print(" ");
  Serial.print(imu.ay);
  Serial.print(" ");
  Serial.print(imu.az);
  Serial.print(" ");
  Serial.println(delta); 
  } // end if
//  
//  imu.readGyro();
//  Serial.print(imu.gx);
//  Serial.print(" ");
//  Serial.print(imu.gy);
//  Serial.print(" ");
//  Serial.print(imu.gz);
//  Serial.print(" ");
//  Serial.println(""); 

//  imu.readMag();
//  Serial.print(imu.mx);
//  Serial.print(" ");
//  Serial.print(imu.my);
//  Serial.print(" ");
//  Serial.print(imu.mz);
//  Serial.println(""); 
  
}

The errors that I get are as follows:

C:\dyn-phantom\src\mcu\wearable_belt\acceleroreader\acceleroreader.ino: In function 'void setup()':

acceleroreader:17:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.device.commInterface = IMU_MODE_I2C;

       ^~~~~~~~

acceleroreader:17:39: error: 'IMU_MODE_I2C' was not declared in this scope

   imu.settings.device.commInterface = IMU_MODE_I2C;

                                       ^~~~~~~~~~~~

C:\dyn-phantom\src\mcu\wearable_belt\acceleroreader\acceleroreader.ino:17:39: note: suggested alternative: 'LB_MODE_2'

   imu.settings.device.commInterface = IMU_MODE_I2C;

                                       ^~~~~~~~~~~~

                                       LB_MODE_2

acceleroreader:18:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.device.agAddress = LSM9DS1_AG;

       ^~~~~~~~

acceleroreader:6:20: error: 'D2' was not declared in this scope

 #define LSM9DS1_AG D2

                    ^

C:\dyn-phantom\src\mcu\wearable_belt\acceleroreader\acceleroreader.ino:18:35: note: in expansion of macro 'LSM9DS1_AG'

   imu.settings.device.agAddress = LSM9DS1_AG;

                                   ^~~~~~~~~~

C:\dyn-phantom\src\mcu\wearable_belt\acceleroreader\acceleroreader.ino:6:20: note: suggested alternative: 'A2'

 #define LSM9DS1_AG D2

                    ^

C:\dyn-phantom\src\mcu\wearable_belt\acceleroreader\acceleroreader.ino:18:35: note: in expansion of macro 'LSM9DS1_AG'

   imu.settings.device.agAddress = LSM9DS1_AG;

                                   ^~~~~~~~~~

acceleroreader:19:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.device.mAddress = LSM9DS1_M;

       ^~~~~~~~

acceleroreader:5:19: error: 'D1' was not declared in this scope

 #define LSM9DS1_M D1

                   ^

C:\dyn-phantom\src\mcu\wearable_belt\acceleroreader\acceleroreader.ino:19:34: note: in expansion of macro 'LSM9DS1_M'

   imu.settings.device.mAddress = LSM9DS1_M;

                                  ^~~~~~~~~

C:\dyn-phantom\src\mcu\wearable_belt\acceleroreader\acceleroreader.ino:5:19: note: suggested alternative: 'A1'

 #define LSM9DS1_M D1

                   ^

C:\dyn-phantom\src\mcu\wearable_belt\acceleroreader\acceleroreader.ino:19:34: note: in expansion of macro 'LSM9DS1_M'

   imu.settings.device.mAddress = LSM9DS1_M;

                                  ^~~~~~~~~

acceleroreader:20:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.gyro.enabled = false;

       ^~~~~~~~

acceleroreader:21:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.mag.enabled = false;

       ^~~~~~~~

acceleroreader:22:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.temp.enabled = false;

       ^~~~~~~~

acceleroreader:26:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.accel.scale = 8;

       ^~~~~~~~

acceleroreader:34:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.accel.sampleRate = 6;

       ^~~~~~~~

acceleroreader:40:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.accel.bandwidth = 0;

       ^~~~~~~~

acceleroreader:42:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.accel.highResEnable = true;

       ^~~~~~~~

acceleroreader:49:7: error: 'class Adafruit_LSM9DS1' has no member named 'settings'

   imu.settings.accel.highResBandwidth = 0;

       ^~~~~~~~

C:\dyn-phantom\src\mcu\wearable_belt\acceleroreader\acceleroreader.ino: In function 'void loop()':

acceleroreader:60:12: error: 'class Adafruit_LSM9DS1' has no member named 'accelAvailable'; did you mean 'accelData'?

   if ( imu.accelAvailable() ){

            ^~~~~~~~~~~~~~

            accelData

acceleroreader:66:20: error: 'class Adafruit_LSM9DS1' has no member named 'ax'

   Serial.print(imu.ax);

                    ^~

acceleroreader:68:20: error: 'class Adafruit_LSM9DS1' has no member named 'ay'

   Serial.print(imu.ay);

                    ^~

acceleroreader:70:20: error: 'class Adafruit_LSM9DS1' has no member named 'az'

   Serial.print(imu.az);

                    ^~

exit status 1

'class Adafruit_LSM9DS1' has no member named 'settings'



Can it be the problem with library? I have reinstalled them, but the problem remains the same.
Help.

seems this is code for another library

as the code resembles this example