In file included from read.ino:5:
MS5803.h:66: error: ISO C++ forbids initialization of member 'press'
MS5803.h:66: error: making 'press' static
MS5803.h:66: error: ISO C++ forbids in-class initialization of non-const static member 'press'
MS5803.h:67: error: ISO C++ forbids initialization of member 'temp'
MS5803.h:67: error: making 'temp' static
MS5803.h:67: error: ISO C++ forbids in-class initialization of non-const static member 'temp'
Is there a problem with library or with arduino ide ?
#include <SPI.h>
#include <Wire.h>
#include <MS5803.h>
// Chip Select pin for SPI
#define SENSOR_CS_PIN 9
// Use this constructor for SPI
MS5803 sensor = MS5803(SENSOR_CS_PIN);
// Use this constructor for i2c - Address is set in the library implementation file. Default is 0x76.
//MS5803 sensor = MS5803();
void setup() {
// Start the serial ports.
Serial.begin( 115200 );
delay(3000);
// Initalize the sensor which resets the sensor, downloads the needed coeffecients,
// and does a CRC check on the returned data. This will verify that we are talking to
// the device and that all is well.
if ( sensor.initalizeSensor() ) {
Serial.println( "Sensor CRC check OK." );
}
else {
Serial.println( "Sensor CRC check FAILED! There is something wrong!" );
}
}
void loop() {
// Call read sensor first, which downloads the sensor data and converts it to
// mBars and Degrees C.
sensor.readSensor();
Serial.print("Pressure = ");
Serial.print(sensor.pressure());
Serial.println(" mBars");
Serial.print("Temperature = ");
Serial.print(sensor.temperature());
Serial.println("C");
//Just to make it easier to read.
//The sensor can be read as fast as desired.
delay(100);
}
But i started to dig in google and those errors says something about initializtion of variables in class , and when i press sendin IDE its jumping to MS5803.h and highligth those lines :
private:
float press =0; // Stores actual pressure in mbars
float temp =0; // Stores actual temp in degrees C.
float press; // Stores actual pressure in mbars
float temp; // Stores actual temp in degrees C
and added:
press = 0;
temp = 0;
to cpp file and error about : ISO C++ forbids initialization of member has gone but now it give me this :
ms5803\MS5803.cpp.o: In function `MS5803':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:62: multiple definition of `MS5803::MS5803(unsigned char)'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:62: first defined here
ms5803\MS5803.cpp.o: In function `MS5803':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:62: multiple definition of `MS5803::MS5803(unsigned char)'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:62: first defined here
ms5803\MS5803.cpp.o: In function `MS5803':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:69: multiple definition of `MS5803::MS5803()'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:69: first defined here
ms5803\MS5803.cpp.o: In function `MS5803':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:69: multiple definition of `MS5803::MS5803()'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:69: first defined here
ms5803\MS5803.cpp.o: In function `MS5803::ms5803CRC4(unsigned int*)':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:183: multiple definition of `MS5803::ms5803CRC4(unsigned int*)'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:183: first defined here
ms5803\MS5803.cpp.o: In function `MS5803::resetSensor()':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:130: multiple definition of `MS5803::resetSensor()'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:130: first defined here
ms5803\MS5803.cpp.o: In function `MS5803::ms5803CmdAdc(char)':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:217: multiple definition of `MS5803::ms5803CmdAdc(char)'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:217: first defined here
ms5803\MS5803.cpp.o: In function `MS5803::readSensor()':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:110: multiple definition of `MS5803::readSensor()'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:110: first defined here
ms5803\MS5803.cpp.o: In function `MS5803::ms5803ReadCoefficient(unsigned char)':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:149: multiple definition of `MS5803::ms5803ReadCoefficient(unsigned char)'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:149: first defined here
ms5803\MS5803.cpp.o: In function `MS5803::initalizeSensor()':
D:\arduino-1.0.5\libraries\ms5803/MS5803.cpp:72: multiple definition of `MS5803::initalizeSensor()'
MS5803.cpp.o:C:\Users\bartek\AppData\Local\Temp\build1708876184977661276.tmp/MS5803.cpp:72: first defined here