私はarduinoのスケッチからいくつかのコードを移動し、再利用可能にする小さなライブラリを書いています。問題は、 "Stringは型を指定していない"ため、コンパイルできないということです。
これは私のコードです(縮小):
myESP.h:
#ifndef MYESP_H
#define MYESP_H
#include "Arduino.h"
#include
#include
#include
#include
#include
#include
#include
class myESP {
private:
const char* _ssid;
const char* _password;
const char* _host;
public:
myESP();
myESP(char * ssid, char * pwd, char * host);
String macToStr(const uint8_t* mac);
String doGet(String data, String sensor, int duration);
};
#endif
myESP.cpp:
#include
#include "Arduino.h"
#include "myESP.h"
myESP::myESP() {}
myESP::myESP(char * ssid, char * pwd, char * host) {
_host = host;
_password = pwd;
_ssid = ssid;
}
myESP::String macToStr(const uint8_t* mac) {
}
myESP::String doGet(String data, String sensor, int duration) {
}
私はそれをコンパイルしようとすると、私は以下を取得します:
/Users/lbedogni/Documents/Arduino/libraries/myESP/myESP.cpp:14:1:
error: 'String' in 'class myESP' does not name a type myESP::String
macToStr(const uint8_t* mac) {
/Users/lbedogni/Documents/Arduino/libraries/myESP/myESP.cpp:22:1:
error: 'String' in 'class myESP' does not name a type myESP::String
doGet(String data, String sensor, int duration) {
私は輸入の順序を変えようとしましたが、図書館を変更しましたが、まだそれはコンパイルされません。
何か案が?