Compilation error with latest esp-idf: string not found.
arrowcircle opened this issue · comments
Hi! Thanks for the great work. I am trying to use this driver in my project, but have compilation error.
As soon as I include #include "BNO055ESP32.h"
in my source, I get string related error
make
Toolchain path: ~/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0
Python requirements from ~/esp/esp-idf/requirements.txt are satisfied.
fatal: bad revision 'HEAD'
Project do not have git repo, it needs to get PROJECT_VER from `git describe` command.
App "awifi" version: ""
CC build/app_update/esp_app_desc.o
AR build/app_update/libapp_update.a
CC build/main/main.o
In file included from ~/esp/awifi/main/main.c:2:0:
~/esp/awifi/components/BNO055ESP32/src/BNO055ESP32.h:33:18: fatal error: string: No such file or directory
compilation terminated.
make[1]: *** [~esp/esp-idf/make/component_wrapper.mk:292: main.o] Ошибка 1
make: *** [~esp/esp-idf/make/project.mk:527: component-main-build] Ошибка 2
Error string is #include <string>
. If I change it to #include "string.h"
I got screen full of errors like:
In file included from ~/esp/awifi/components/BNO055ESP32/src/BNO055ESP32.cpp:28:0:
~/esp/awifi/components/BNO055ESP32/src/BNO055ESP32.h:462:7: error: 'string' in namespace 'std' does not name a type
std::string _msg;
Without including bno055 header everything works fine. I am new to esp-idf, so maybe its stupid question.
What I doing wrong?
because you're trying to use a C++ library in a C file.
cd ~/esp/awifi/main/
mv main.c main.cpp
and change
void app_main(){
//cool suff
}
to
extern "C" void app_main(){
//cool stuff
}
I'll close this for now, reopen if needed (maybe check first on StackOverflow)
Thanks for your interest.