Hi,
I have a project with the structure defined as in this image.
The file Aircon_def.h has some constants I want to use on the ui_events.c
#include <Arduino.h>
struct controlInfo {
String ret;
String power;
String mode; //0 - fan. 1 - heat 2 - cool 3 - auto 7 - dry
String temperature;
String fanRate; // 1 - level 1 3 - level 2 5 - level 3
String shum;
String f_dir;
};
const int FAN = 0;
const int HEAT = 1;
const int COLD = 2;
const int AUTO = 3;
const int DRY = 7;
const int numberOfZones = 8;
const String ON = "1";
const String OFF = "0";
struct zonesStatusStruct{
String zoneStatus[8];
String zoneNames[8];
};
The project compiles fine, but when I include Aircon_def.h on ui_events.c it throws the error below:
uilding in release mode
warning: Calling missing SConscript without error is deprecated.
Transition by adding must_exist=False to SConscript calls.
Missing SConscript 'support/sdl2_build_extra.py'
File "/Users/eduardo/.platformio/penv/lib/python3.10/site-packages/platformio/builder/main.py", line 195, in <module>
Compiling .pio/build/esp8266/src/AirconnController.ino.cpp.o
Compiling .pio/build/esp8266/src/ui/ui_events.c.o
In file included from src/ui/ui_events.c:8:
src/ui/../Aircon_def.h:4:3: error: unknown type name 'String'
4 | String ret;
| ^~~~~~
src/ui/../Aircon_def.h:5:3: error: unknown type name 'String'
5 | String power;
| ^~~~~~
src/ui/../Aircon_def.h:6:3: error: unknown type name 'String'
6 | String mode; //0 - fan. 1 - heat 2 - cool 3 - auto 7 - dry
| ^~~~~~
src/ui/../Aircon_def.h:7:3: error: unknown type name 'String'
7 | String temperature;
| ^~~~~~
src/ui/../Aircon_def.h:8:3: error: unknown type name 'String'
8 | String fanRate; // 1 - level 1 3 - level 2 5 - level 3
| ^~~~~~
src/ui/../Aircon_def.h:9:3: error: unknown type name 'String'
9 | String shum;
| ^~~~~~
src/ui/../Aircon_def.h:10:3: error: unknown type name 'String'
10 | String f_dir;
| ^~~~~~
src/ui/../Aircon_def.h:22:7: error: unknown type name 'String'
22 | const String ON = "1";
| ^~~~~~
src/ui/../Aircon_def.h:22:19: warning: initialization of 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
22 | const String ON = "1";
| ^~~
src/ui/../Aircon_def.h:23:7: error: unknown type name 'String'
23 | const String OFF = "0";
| ^~~~~~
src/ui/../Aircon_def.h:23:20: warning: initialization of 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
23 | const String OFF = "0";
| ^~~
src/ui/../Aircon_def.h:26:3: error: unknown type name 'String'
26 | String zoneStatus[8];
| ^~~~~~
src/ui/../Aircon_def.h:27:3: error: unknown type name 'String'
27 | String zoneNames[8];
| ^~~~~~
*** [.pio/build/esp8266/src/ui/ui_events.c.o] Error 1
==================================== [FAILED] Took 2.96 seconds ====================================
Environment Status Duration
------------- -------- ------------
esp8266 FAILED 00:00:02.957
=============================== 1 failed, 0 succeeded in 00:00:02.957 ===============================
Here is the inclusion
#include "ui.h"
#include "ui_helpers.h"
#include "../Aircon_def.h"
void setOnOff(lv_event_t * e)
{
// Your code here
}
void setOperatingMode(lv_event_t * e)
{
// Your code here
}
void setFanSpeed(lv_event_t * e)
{
// Your code here
}