Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It sounds like the crux of your problem is this:</p> <blockquote> <p>Is the compiler not recognising that MyClass.hh is Objective-C++ not Objective-C?</p> </blockquote> <p>The compiler is <em>not</em> recognizing that MyClass.hh is Objective-C++ code. Or any other code; the <em>compiler</em> never sees MyClass.hh (in all likelyhood).</p> <p>By convention, header files are never passed to the compiler by default. Only the source files (.cpp, .m, et cetera) are -- the preprocessor that is run on those files results a translation unit that contains the original source file plus all the included headers and resolved macros. </p> <p>So the problem is that you probably have a .mm source file that imports MyClass.hh, which in turn includes the C++ header file. But the compiler is trying to compile the resulting translation unit as Objective-C++ and encountering some C++-specific stuff in that header. In fact, I suspect that this problem has nothing at all to do with the additional target dependencies and such that you've got set up: I think you could reproduce it minimally with a very simple Objective-C++ application that includes the header. You should try that and see, it will either confirm my theory (after all I'm just speculating since you haven't shown enough source for me to know for sure) or indicate that the problem is elsewhere.</p> <p>The solution is probably to use preprocessor guards like <code>#ifdef __cplusplus</code> (there's a useful catalog of predefined symbols <a href="http://sourceforge.net/apps/mediawiki/predef/index.php?title=Main_Page" rel="nofollow">here</a>) to hide the C++-specific code from the Objective-C++ compiler (or the other way around in some cases). Note that this may be difficult to impossible to do based on the actual content of the header.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload