I’m trying to write a simple bluetooth project to get used to the PlatformIO style after having programmed both with the Arduino IDE and using ESP-IDF. I am developing on an esp32 using the Arduino framework. The project runs fine when I run it all in the main.cpp file, but as soon as I try to separate the bluetooth code into its own module compilation fails. It seems that I can’t
in my new module. What must I do to be able to import headers outside the main.cpp file?
Sorry about that, it was just a typo in the original question. I am using:
I have edited the question for clarity. To clarify further, the code doesn’t complain about the #include statement, it complains when I declare a BluetoothSerial variable and when I try to use that same variable. eg:
What did fix the issue was the last paragraph in your answer. The error was I was trying to use the class in a file bluetooth.c instead of a bluetooth.cpp file. I can’t believe I hadn’t noticed that sooner.