Then a simple std::thread program:
Code: Select all
void task_1() {
int i=0;
while(i++<10)
{
printf("Its alive!\n");
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
}
/**
* @brief Application main.
*/
extern "C" void app_main()
{
std::thread first (task_1);
vTaskDelay((5*1000) / portTICK_PERIOD_MS);
first.join();
Code: Select all
c:/msys32/opt/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:/msys32/home/Pete/esp/Task/build/main\libmain.a(app_main.o):(.rodata._ZTINSt6thread11_State_implINS_8_InvokerISt5tupleIJPFvvEEEEEEE[typeinfo for std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >]+0x8): undefined reference to `typeinfo for std::thread::_State'
collect2.exe: error: ld returned 1 exit status
Code: Select all
CXXFLAGS += -pthread
Code: Select all
xtensa-esp32-elf-c++.exe: error: unrecognized command line option '-pthread'