I've recently started playing with the ESP32 using the Arduino IDE, but have now tried to swap to the ESP-IDF and Visual Studio Code tool chain so I've got more control. I'm just starting out with C++, but have experience with other languages.
I've successfully installed the ESP tool chain, msys32 and mingw32 seem to be working okay - I can compile and flash the example 'hello world' program to the ESP32 from the mingw32 command line.
I've followed guides on setting up Visual Studio Code to work with the ESP-IDE and can compile and flash the 'hello world' program to the ESP32 from VS Code successfully.
However, I've been going round in circles trying to get access to the C++ string library. I need it to progress my program for the ESP32, which uses http_server, to analyse and act upon queries passes in the URL.
I've included string:
Code: Select all
#include <stdio.h>
#include <string.h>
Code: Select all
if (std::to_string(var) == "text") { blah }
Code: Select all
std::string text = "Hello!";
Code: Select all
$ make
Python requirements from C:/msys32/home/user/esp-idf/requirements.txt are satisfied.
CC build/main/main.o
C:/msys32/home/user/esp-test/main/main.c: In function 'gpio_get_handler':
C:/msys32/home/user/esp-test/main/main.c:164:10: error: 'std' undeclared (first use in this function)
if (std::to_string(GPIOs[n]) == param) {
^
C:/msys32/home/user/esp-test/main/main.c:164:10: note: each undeclared identifier is reported only once for each function it appears in
C:/msys32/home/user/esp-test/main/main.c:164:13: error: expected ')' before ':' token
if (std::to_string(GPIOs[n]) == param) {
^
make[1]: *** [/home/user/esp-idf/make/component_wrapper.mk:286: main.o] Error 1
make: *** [C:/msys32/home/user/esp-idf/make/project.mk:481: component-main-build] Error 2
Seems to me there's an issue with my C++ installation or path... but everything else compiles okay. Any ideas?