Failing to name a type for an Analog Sensor

I want to write a library for a analog sensor to use in school.

I tried to enter the PinName in my main programm. While comiling I alwais get the error message that the
“Soil_Moisture_Sensor_Analog” does not name a type.

I checkt the spelling and removed the PinName from the class initialisation. But I always get this error message.

Compiling .pio\build\nucleo_f446re\libc72\Soil_Moisture_Sensor_Analog\Soil_Moisture_Sensor_Analog.o
lib\Soil_Moisture_Sensor_Analog\Soil_Moisture_Sensor_Analog.cpp:5:1: error: ‘Soil_Moisture_Sensor_Analog’ does not name a type
5 | Soil_Moisture_Sensor_Analog::Soil_Moisture_Sensor_Analog(){
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
*** [.pio\build\nucleo_f446re\libc72\Soil_Moisture_Sensor_Analog\Soil_Moisture_Sensor_Analog.o] Error 1
src\main.cpp:5:1: error: ‘Soil_Moisture_Sensor_Analog’ does not name a type
5 | Soil_Moisture_Sensor_Analog Analog_Sensor
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
*** [.pio\build\nucleo_f446re\src\main.o] Error 1
========================= [FAILED] Took 24.23 seconds =========================

I even tried to run my programm in the mbed online compiler and mbed studio.

Has anyone experience with this error and can help me fix it?

Hi,

I think the header include guard should be #ifndef rather than #ifdef.

Thanks,
Toyo

It worked.
Thank you very much.