Sunday, December 1, 2013

Objective-C reference to C + + classes

I use C + + to write an algorithm stored in a cpp inside. Now I want. M file referenced in the C + + class in Objective-C, and call its class members, how they could not achieve?
Reply:
First. M file suffix rewrite. Mm file. Then you write with c + + # import came algorithm can be friends.
Reply:
cited a floor reply:.
first rewrite mm m file extension file. Then you write with c + + # import came algorithm can be friends.

Mm files currently used in the header file # import or # include introducing cpp compiler will complain that I remove it properly
Reply:
First: check the project settings "Apple LLVM compiler 3.1 - Language" section.
Second: whether to use some template class

Reply:
No change. Mm file, because that is. Mm file compiler was able to identify the c + + code.
Reply:
It must be included in the. Mm file, not included in the header file ah. Header files using @ class.
Reply:
references, 4th Floor reply:
no change mm file, because the file is mm was able to identify the compiler c + + code.

Identified, a link error, syntax and prove no problem.
Reply:
reference to the third floor of the reply: First
: check the project settings "Apple LLVM compiler 3.1 - Language" section.
Second: whether to use some template class

Which specific settings?
Reply:
references, 5th Floor reply:
mm file must be included in it, do not include the header file ah. Header files using @ class.

It did not work linker command failed with exit code 1 (use-v to see invocation)
Reply:
The reply was deleted at the moderator 2012-07-24 09:48:04

Reply:
If you have a c + + code, the compiler option was selected objective-c + +

No comments:

Post a Comment