I am not able to include some standard libraries:
#include <stdio.h> // <= this works
// #include <thread> // <= error: "No such file or directory"
// #include <algorithm> // <= error: "No such file or directory"
void app_main(void)
{
}
The error is generated by compiler xtensa-esp32-elf-gcc.exe
. There is no error from C/C++ Intellisense. And I am able to find the necessary header by pressing F12. They are placed on the path C:\Espressif\tools\xtensa-esp32-elf\esp-2021r2-patch3-8.4.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\8.4.0
. There is no such path in the compiler -I
arguments.
How can I deal with this error?
Thread and algorithm are both part of C++ standard library, not C standard library. I've renamed the source file to.cpp (CMakeLists.txt was updated by VSCode automatically). Then I added:
extern "C" {
void app_main();
}
And it works. Hope it helps somebody.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.