Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fernandovalente

macrumors 6502
Original poster
People always told me I can mix Objective-C, C and C++. I'm trying to write a program in Objective-C and C++. I tried to include iostream on my Objective-C code, but I got an error "File not found". How do I mix Objective-C with C++?
 
Make sure to give your "Objective-C++" file the .mm extension, so the compiler knows it's not an ordinary Objective-C file and sets its include paths correspondingly.

Note that there are limitations as to what features of C++ you can use and how you can use them. It's best to google for "Objective-C++" and read the primer on Apples website.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.