Programming in C++
Re: Programming in C++
If I use any std C++ stuff, and I include "stdc++ library, I get this link error:
/opt/esp32/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/4.8.5/../../../../xtensa-esp32-elf/lib/libstdc++.a(vterminate.o):(.literal._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x8): undefined reference to `_impure_ptr'
collect2: error: ld returned 1 exit status
Does anyone knows how to solve it ?
If I remove the references to "std::string" for example and don't link "stdc++", the program links fine.
/opt/esp32/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/4.8.5/../../../../xtensa-esp32-elf/lib/libstdc++.a(vterminate.o):(.literal._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x8): undefined reference to `_impure_ptr'
collect2: error: ld returned 1 exit status
Does anyone knows how to solve it ?
If I remove the references to "std::string" for example and don't link "stdc++", the program links fine.
Re: Programming in C++
bump ... I just ran into the exact same issue.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Programming in C++
Earlier in this thread there was a discussion on the naming conflicts in a C++ application if we try and create methods with the same names as LWIP #defines. For example, if I try and create a method called "connect" or "close" or "send" we fail because those appear to be #defined against the lwip functions. Has anyone found a workaround? Espressif commented back in November that they had an idea as to a way to fix but didn't elaborate on it.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
-
- Posts: 14
- Joined: Sun Jan 03, 2016 12:15 am
Re: Programming in C++
Hi ESP_igrr and kolban,
May I know the current process to support C++11 thread/concurrency library?
I wish to perform matrix operations in ESP32, and C++"Eigen.h" library would be a good fit. Eigen does depends on a C library called LAPACK, but I failed to link the library to my program, and LAPACK wasn't friendly for starters. Does looking forward for a guide to setup the Makefile to compile C++ library in the main project.
Best,
Beck
May I know the current process to support C++11 thread/concurrency library?
I wish to perform matrix operations in ESP32, and C++"Eigen.h" library would be a good fit. Eigen does depends on a C library called LAPACK, but I failed to link the library to my program, and LAPACK wasn't friendly for starters. Does looking forward for a guide to setup the Makefile to compile C++ library in the main project.
Best,
Beck
Re: Programming in C++
While the C++ standard library does provide a "threading model" ... see for example:
http://www.cplusplus.com/reference/thread/thread/
To the best of my knowledge this has not been mapped in the ESP-IDF to the FreeRTOS "task" model. Thus if you have pre-existing (non ESP32 originated code) that leverages the "std::thread" class, it won't work (opinion). In theory, it would be possible to map the C++ threading packages to FreeRTOS but I have no knowledge of whether that is a task to be attempted.
http://www.cplusplus.com/reference/thread/thread/
To the best of my knowledge this has not been mapped in the ESP-IDF to the FreeRTOS "task" model. Thus if you have pre-existing (non ESP32 originated code) that leverages the "std::thread" class, it won't work (opinion). In theory, it would be possible to map the C++ threading packages to FreeRTOS but I have no knowledge of whether that is a task to be attempted.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Programming in C++
Mapping STL concurrency library to FreeRTOS is possible, and has been done in some other MCU programming environments, but we don't have this feature planned at the moment.
Re: Programming in C++
Hello
I rename the main.c to main.cpp but the compiler just want main.c ...
$ make
CC main.o
xtensa-esp32-elf-gcc: error: /home/gigijoe/ESP32/SGM9200/main/./main.c: No such file or directory
xtensa-esp32-elf-gcc: fatal error: no input files
compilation terminated.
I'm running with latest SDK, any one have idea ?
I rename the main.c to main.cpp but the compiler just want main.c ...
$ make
CC main.o
xtensa-esp32-elf-gcc: error: /home/gigijoe/ESP32/SGM9200/main/./main.c: No such file or directory
xtensa-esp32-elf-gcc: fatal error: no input files
compilation terminated.
I'm running with latest SDK, any one have idea ?
Re: Programming in C++
I have sometimes seen that if one renames a source from X.c to X.cpp but has not issued a "make clean" then the build system seems to somehow "remember" that source was once "X.c". Can you try a "make clean" and then a full re-build and see if that helps?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Programming in C++
Hello kolban
Yes, make clean works
Now the build system compile main.cpp
Thank you
Yes, make clean works
Now the build system compile main.cpp
Thank you
Who is online
Users browsing this forum: Google [Bot] and 125 guests