Is there anything wrong with
#import "SomeCppHeaderFile.h"
in an objective C++ header? Or should I be including like this (is there any difference if the cpp header has the usual #ifndef #define #endif
header gard macros)
#include "SomeCppHeaderFile.h"
There is nothing wrong with #import "SomeCppHeaderFile.h"
. The #import
directive does exist in the C/C++ preprocessors of GCC and Clang; the difference with #include
is that it is designed to not include twice the same file in the same compilation unit.
This directive is not standard C, so if you expect to ship your libraries on other systems, be careful. As far as I know, it is supported only by GCC and Clang, and the guys at GCC don't like it much for this reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With