When I describe a function in header file, compiler can’t find String class, even thought I’ve included Arduino.h
.
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
src/main.cpp:
#include <Arduino.h>
#include "time.h"
...
src/time.h:
#ifndef TIME_H
#define TIME_H
#include <Arduino.h>
#include <string.h>
String renderTime(long t);
#endif
src/time.cpp:
#include "time.h"
String renderTime(long t) {
return "test";
}
On build I get an error from compiler: src/time.h:7:1: error: 'String' does not name a type
.
What am I doing wrong?