Running LSM6DSO example code

Hello, New to arduino

I created a Library in my Documents/Arduino folder, and the IDE sees it OK

I tried compiling the following code from the example

#include “SparkFunLSM6DSO.h”

#include “Wire.h”

//#include “SPI.h”

LSM6DSO myIMU; //Default constructor is I2C, addr 0x6B

void setup() {

Serial.begin(115200);

delay(500);

Wire.begin();

delay(10);

if( myIMU.begin() )

Serial.println(“Ready.”);

else {

Serial.println(“Could not connect to IMU.”);

Serial.println(“Freezing”);

}

if( myIMU.initialize(BASIC_SETTINGS) )

Serial.println(“Loaded Settings.”);

}

void loop()

{

//Get all parameters

Serial.print(“\nAccelerometer:\n”);

Serial.print(" X = ");

Serial.println(myIMU.readFloatAccelX(), 3);

Serial.print(" Y = ");

Serial.println(myIMU.readFloatAccelY(), 3);

Serial.print(" Z = ");

Serial.println(myIMU.readFloatAccelZ(), 3);

Serial.print(“\nGyroscope:\n”);

Serial.print(" X = ");

Serial.println(myIMU.readFloatGyroX(), 3);

Serial.print(" Y = ");

Serial.println(myIMU.readFloatGyroY(), 3);

Serial.print(" Z = ");

Serial.println(myIMU.readFloatGyroZ(), 3);

Serial.print(“\nThermometer:\n”);

Serial.print(" Degrees F = ");

Serial.println(myIMU.readTempF(), 3);

delay(1000);

}

And I get an output error

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:17:0,

from C:\Users\Robert_Salasidis.SALASOFTMAIN\Documents\Arduino\libraries\LSM6DSO_Lib\SparkFunLSM6DSO.h:32,

from C:\Users\Robert_Salasidis.SALASOFTMAIN\Documents\Arduino\libraries\LSM6DSO_Lib\SparkFunLSM6DSO.cpp:36:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:154:6: error: conflicting declaration of ‘void setup()’ with ‘C’ linkage

void setup(void);

^~~~~

C:\Users\RS\Documents\Arduino\libraries\LSM6DSO_Lib\SparkFunLSM6DSO.cpp:1:6: note: previous declaration with ‘C++’ linkage

void setup() {

^~~~~

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src/SPI.h:17:0,

from C:\Users\RS\Documents\Arduino\libraries\LSM6DSO_Lib\SparkFunLSM6DSO.h:32,

from C:\Users\RS\Documents\Arduino\libraries\LSM6DSO_Lib\SparkFunLSM6DSO.cpp:36:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:155:6: error: conflicting declaration of ‘void loop()’ with ‘C’ linkage

void loop(void);

^~~~

C:\Users\RS\Documents\Arduino\libraries\LSM6DSO_Lib\SparkFunLSM6DSO.cpp:6:6: note: previous declaration with ‘C++’ linkage

void loop() {

^~~~

exit status 1

Error compiling for board Arduino Nano.

Any ideas where the problem is?

Thanks

I found that the example SparkFunLSM6DSO.cpp had the void and setup redefined - on removal it compiled OK