Question

I've been trying to import DTCoreText.h in a class with both Objective-C and C++ code, but it results in the following cryptic compilation errors:

Compilation errors

The code doesn't have syntax errors and works correctly when I use it in classes written exclusively in Objective-C, but if I change their extension to .mm the compilation fails. This indicates that is something related to the C++ compiler, but I'm not sure exactly what.

Does anyone have a clue? Thanks.

Was it helpful?

Solution

This was happening due to the fact that some method signatures had parameters with the name class which is a reserved keyword in C++ and eventually led to the compilation errors I've listed above.

Changing the parameters name fixed it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top