I am currently learning how to write my own library for my mbed electronics project. So far I have two files cfExtensions.cpp and cfExtensions.h files. I referenced my variables in the cfExtensions.h constructor and changed their values within my cfExtensions.cpp file; however my mbed c++ compiler throws: identifier "phMin" is unidentified. My code is:
FILE: cfExtensions.h /* File: cfExtensions.h
Header file for cfExtensions Library.
*/
#ifndef __cfExtns_H
#define __cfExtns_H
#include "mbed.h"
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//==================================
// Definitions
//==================================
#define CF_FILE_LOCATION  "local/settings.cf"     // File location local/settings.cf
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//==================================
// cfExtension Class
//==================================
class cfExtensions
{
public:
//---------------------------
// Function Prototypes
//---------------------------
        cfExtensions();                         // Constructor, Initialisation tasks
        void loadConfigFile();                  // Loads config file defined in CF_FILE_LOCATION
        void checkConfigForFirstStart();        // Check if MBED startup is the very first startup
        void getPhMaxValueFromConfigFile();     // Get PH Max value from config file
        void getPhMinValueFromConfigFile();     // Get PH Min value from config file
        void getKeyAndValue();
//---------------------------
// Variables
//---------------------------
        volatile bool pingTicked;
        bool linkedWithBaseStation;
        char *sbNameKey;
        char sbNameValue[BUFSIZ];
        char *sbFirstStartKey;
        char sbFirstStartValue[BUFSIZ];
        char *sbUseBaseStationKey;
        char sbUseBaseStationValue[BUFSIZ];
        char *sbPhMaxKey;
        char sbPhMaxValue[BUFSIZ];
        char *sbPhMinKey;
        char sbPhMinValue[BUFSIZ];
        float phMax;
        float phMin;
//---------------------------
// Devices
//--------------------------- 
};
#endif
FILE: cfExtensions.cpp
//================================ // Get PH Min Value from CF //================================ void getPhMinValueFromConfigFile() { /* * Get a configuration value. * Then attach the sbNameValue to SensorData json */ if (cfg.getValue(sbPhMinKey, &sbPhMinValue[0], sizeof(sbPhMinValue))) { phMin = atof(sbPhMinValue); } } // End of getPhMinValueFromConfigFile
 
     
     
    