I have a C ++ class that I would like to use in an iPhone / iPad project .
I created this file in different ways (for example, with "New File" => C ++), and the error is always the same.
When I compile the project without any #import (from the .h C ++ class), this is normal.
But as soon as I # import the header file in one of the objective-c header files, I get an error, for example:
error: vector: No such file or directory
or
error: expected '=', ',', ';', 'asm' or ' attribute ' to ':' token
I tried setting various values ββto a file type (C ++ class) in File Info, renaming my objc class to .mm, etc., but it does not work.
So, I must have missed something about importing the .h C ++ class into the objc header file, but that: p ^^
SOLUTION thanks to Vlad
1 Β°) To include a C ++ header file:
#ifdef __cplusplus #include "Triangulate.h" #endif
2 Β°) Rename the objc file to .mm And in its settings file file information file (right clic) as sourcecode.cpp.objcpp
Thanks for the help! Vincent
c ++ iphone compilation xcode
Vinzius
source share