2020-11-07 12:46 AM
hello everyone
I'm trying to use a string type (string class not char pointer or array) in my code
I have a lot of string messages in my program and a string class can help a lot
I see how arduino did it in their IDE, their string class is good, I think it should be possible to use it with ST32 MCUs,
I'm using Discovery (disco1) board with ST32CubeIDE.
2020-11-07 05:39 PM
Convert your project to C++ (right click project -> Convert to C++), add a C++ source file, and use string within it:
#include <string>
std::string this_is_a_string = "Hello world!";
I verified this compiles but I did not test functionality.
You can also rename source files from *.c to *.cpp, but this can mess up global function references unless you do "extern "C"" to keep C linkage.