Well, this is a
Java forum so I don't have any C++ answers. For Java, we use a Rational
Rose script from Unisys that exports a Rose model to XMI. From there we use a vendor written XSL script to translate XMI to Java.
If you can find a free UML tool that exports XMI you could probably write your own XSL to do the transform to C++. I hate XSL so I won't offer to help
