Sign in to follow this  

C++ problem with Objective C.

Recommended Posts

<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 this post

Link to post
Share on other sites

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


Now I'm getting linker problems:


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
(null): Symbol(s) not found for architecture x86_64
(null): Linker command failed with exit code 1 (use -v to see invocation)
Edit: I fixed it by renaming one of the .mm files to .m. :)
Edited by sjhalayka

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this