I'm trying to build a modular code for ESP32 (using the Arduino wrapper) and using the BluetoothSerial library. But getting 'BluetoothSerial' does not name a type error. After googling and trying out a few posted solutions it's not working. But the weird thing is, the same code is working under Linux (same IDE version and ESP32 wrapper, 1.8.19 and 2.0.2 respectively).
My main ino file (test.ino)
#include "spp_serial.h"
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
My header file (spp_serial.h)
#ifndef SPP_SERIAL_H
#define SPP_SERIAL_H
#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
#endif
I've tried changing the file name, the include guards (like __SPP_SERIAL_H__). Unfortunately I don't know what is going on or how Linux is able to compile it. What difference does it make in Linux.
Exact error message/log
In file included from C:\Users\gogo\Documents\sketches\test\spp_serial.h:3,
from C:\Users\gogo\Documents\sketches\test\test.ino:1:
C:\Users\gogo\Documents\sketches\test\bluetoothserial.h:5:1: error: 'BluetoothSerial' does not name a type
In file included from C:\Users\gogo\Documents\sketches\test\test.ino:1:
spp_serial.h:5:1: error: 'BluetoothSerial' does not name a type
BluetoothSerial SerialBT;
^~~~~~~~~~~~~~~
exit status 1
'BluetoothSerial' does not name a type
Pictures:
On windows:
On Linux:

