What are some off the open source, popular choices for a C++ compatible RTOS (besides mbed)? I've heard that FreeRTOS doesn't provide official support for C++ compilation and it's a nightmare getting into work.
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
The short answer to your question is:
"Real" RTOS and "real" C++ are mutually exclusive. So, you can't.
C++'s syntax allows resource allocation and deallocation during runtime. In fact, most C++ developers (and judging by your question, you belong to these) won't even notice when that happens. In fact, chances are high you want C++ exactly because it can do that (and you don't have to do your own memory management and/or preallocate everything). It's a language feature C++ has, but C hasn't.
That's an idea incompatible to an RTOS, because it's non-deterministic in complexity (depends on instantaneous memory fragmentation, which depends on what your system has been doing before).
You can use C++ in a manner that doesn't do any run-time allocations. That requires a very high degree of discipline during development; and you can't use any of the standard library things (especially no
std::vector…) and ABSOLUTELY no exceptions (you can probably even disable exception handling in the compiler).
People who develop RTOSes for automotive applications do allow C++ in some kernels, but they replace all the standard library's allocators by one that allows object creation during "bootup", but then a switch is flipped and at runtime, they stop doing anything but just signal a fault to the OS when they're used at all, which then stops operation.
As you can imagine, that's a nightmare to write code for. The software doesn't look like C++ code much anymore.
I'll be blunt: C++ is not the language you want to use here, already because FreeRTOS often runs on systems where you wouldn't even want the C++ runtime memory overhead in the first place... So do yourself a favor, learn C99 and a bit of C11, and do things in C.