Closed as not planned
Description
Describe the problem
I have a file called utils.h
which I include from my main .ino
sketch
utils.h
has:
#include <WiFiManager.h>
The app builds fine in Arduino IDE and also with arduino-cli with this command:
arduino-cli compile -b esp8266:esp8266:d1_mini include.ino -e
However if I add a --build-property
like this:
arduino-cli compile -b esp8266:esp8266:d1_mini include.ino -e --build-property "build.extra_flags=\"-DSCREEN=64\""
The build fails claiming WifiManager
has not been declared:
C:\ard\common\utils.h:887:4: error: 'WiFiManager' was not declared in this scope; did you mean 'WiFiManager_h'?
11 | WiFiManager wifiManager;
| ^~~~~~~~~~~
I accept that perhaps my utils should be a pair of .h
and .cpp
files (I have code in the .h
file) but it is the case that it all works perfectly without the --build-properties
flag.
Here is the minimized utils.h
file:
//utils
#ifndef utils_h
#define utils_h
#include "ESP8266WiFi.h"
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
void WiFiMan(char const* APName, int timeout) { // use wifi manager to ask for credentails
WiFiManager wifiManager;
} // WiFiMan
#endif // #ifndef utils
and the include.ino
file:
#include "utils.h" // includes Wifimanager
void setup(){}
void loop(){}
To reproduce
- Ensure you have a library such as
<WiFiManager.h>
installed - Place
include.ino
andutils.h
in a folder - From Windows command prompt,
cd
to the folder - Issue the command:
arduino-cli compile -b esp8266:esp8266:d1_mini include.ino -e
- Note that the sketch compiles OK
- Issue the command:
arduino-cli compile -b esp8266:esp8266:d1_mini include.ino -e --build-property "build.extra_flags=\"-DSCREEN=64\""
- Note that the build no longer compiles
Expected behavior
I expect the build to succeed with both compile commands.
Arduino CLI version
nightly-20230122 Commit: a58d5ad Date: 2023-01-22T01:33:46Z
Operating system
Windows
Operating system version
11
Additional context
No response
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the nightly build
- My report contains all necessary details