Is anybody using OCUnit (as in Xcode 4.2 Unit Testing) with C++ code successfully?
After hours trying to understand what's going on I'm now pretty convinced there are some major flaws in using Xcode 4 and OCUnit to test C++ code from Objective-C++ files (.mm)
The main application (Cocoa with some C++ business logic) compiles fine! The trivial .mm test class fails with weird compiler errors, varying between
and so forth. Basically it seems to be terribly confused with the C++ bits. The classes the test files complain about compile JUST FINE from the main application! They can be instantiated in the main application JUST FINE.
Anybody having encountered and solved this before?
Thanks, Jay
When I unit tested C++ code with OCUnit, I had to make the C++ implementation files members of the unit test target to get unit tests to work. Select a C++ file from the project navigator and open the file inspector. There should be a Target Membership section in the file inspector. The Target Membership section has a list of your project's targets with a checkbox next to each target. Select the checkbox next to the unit test target to make the file a member of the unit test target.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With