C++: Cannot find preferences library
Posted: Thu Aug 15, 2019 12:37 pm
I'm new to C++, and trying to write a class.
This class uses the Preferences library imported with #include <Preferences.h> as visible at the top
The issue is that I'm getting error messages when trying to use it in the .h file.
I've tried moving it to main, the errors went away and the Parameters object was successfully created after a test run.
I've been researching the error in vain, no club how to fix this ...
The class code (snippet of the header file):
The error in a screenshot:
Code structure :
contents of PHX.h:
When used in main.cpp, works without problem :
This class uses the Preferences library imported with #include <Preferences.h> as visible at the top
The issue is that I'm getting error messages when trying to use it in the .h file.
I've tried moving it to main, the errors went away and the Parameters object was successfully created after a test run.
I've been researching the error in vain, no club how to fix this ...
The class code (snippet of the header file):
Code: Select all
#ifndef PHX_WIFI
#define PHX_WIFI
#include <Arduino.h>
#include <Preferences.h>
#include "WiFiConfig.h"
class wifi {
Preferences preferences;
std::string preferencesNamespace = "WiFiConfig";
std::string preferencesKey_SSID = "SSID";
std::string preferencesKey_Password = "password";
public:
WiFiConfig getStoredConfig(void);
} ;
#endif
The error in a screenshot:
Code structure :
Code: Select all
src
|___main.cpp
|___PHX/
|___PHX.h
|___wifi.h
|___wifi.cpp
Code: Select all
namespace PHX
{
#include "wifi.h"
#include "WiFiConfig.h"
} // namespace PHX