David
David

Reputation: 428

C++ in iOS Development issues

So I have a .h file and when I include iostream xcode says that header file doesnt exist. But what is making me mad is that whenever I go though the new file process choosing c++ class the default .h file comes with one line of code, which includes iostream.h so when I import that to my Objective-C code it fails to compile.

Upvotes: 0

Views: 247

Answers (1)

rob mayoff
rob mayoff

Reputation: 385500

If you put #include <iostream> in a .h file, then you must be sure to only include that .h file in C++ files (.cpp or .cc) or Objective-C++ files (.mm). You're getting a compiler error because you're including your .h file in a C (.c) or Objective-C (.m) file.

Upvotes: 4

Related Questions