The most likely reason for this is that you include Question.h in a non-C ++ file, for example, maybe your AppDelegate is a .m file, and you are trying to include Question.h there.
There are two solutions. First, you can do all Objective-C ++ (renaming all .m files to .mm). Historically, I found this to be extremely inconvenient because Xcode and gdb always had big problems with ObjC ++, and you can get a lot of confusion (the terrible errors “no this pointer” and “unknown language for the stack” in GDB). I have not done enough work with the latest versions of Xcode and gdb to determine if this is all a problem, but I suspect that since gdb did not get much work. In addition, ObjC ++ is slower to compile.
Another option is to end your C ++ in ObjC so that you can freely add it to the clean parts of ObjC code. This is the approach that I usually take. ObjC ++ is a bit of a mess of the IMO language, and I think it's best to keep ObjC (.m) and C ++ (.cpp) clean and split with a thin layer of ObjC ++ (.mm) to glue them together.
source share