How to include C++ header file in objective-c++ header

Hello,

I am facing a problem in including a C++ header file like vector, set etc. in a objective-c++ header.

Lets suppose, I am having 2 files: abc.h abc.mm

Now, when I try to include the C++ header in abc.mm file, no build error is coming. But when I try to include the C++ header in abc.h file, it is throwing build error. Build error is: Header not found.

How to resolve this error? Any suggestion will be helpful.

Thanks Asheesh

Into what other file are you trying to include your abc.h ?

You can’t include it in an Obkective-C .m file, if it includes a C++ header.

(You might want to use the extension .hh to distinguish between obj-C and obj-C++ headers.)

You might want to use the extension .hh to distinguish between Obj-C and Obj-C++ headers.

Or, if you want one header to be usable from both [Objective-]C++ and [Objective-]C, add a guard:

#if defined(__cplusplus)

… do C++ specific stuff …

#endif

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

on compilation of abc.h header file

try renaming it to .hh.

I have tried using .hh file extension but facing the same error.

How to include C++ header file in objective-c++ header
 
 
Q