• 11
• 9
• 10
• 9
• 10

C++ problem with Objective C.

This topic is 513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I can't #include <iostream> because it gives me an error "Expected unqualified-id".

Anyone have any experience with this?

Share on other sites

<iostream> is a C++ header. Objective-C is based on C, not C++. So the C++ constructs in a C++ header are unintelligible and will cause compiler errors.

You can build your Cocoa projects in Objective-C++ instead, this will let you include C++ headers. If you're using Xcode this is as simple as changing the file extensions from .m to .mm.

Share on other sites

Indeed, the problem was that one of the .m files had to be renamed to .mm.

Showing Recent Issues
(null): "_OBJC_CLASS_$_GLKViewController", referenced from: (null): _OBJC_CLASS_$_GameViewController in GameViewController.o
(null): "_OBJC_METACLASS_$_GLKViewController", referenced from: (null): _OBJC_METACLASS_$_GameViewController in GameViewController.o