Reputation: 450
In my iOS project I need to use a C++ library consisting in some header (.h) files and a .a library file (I don't have any actual source code).
In my Obj-c code I imported the .h header that I need, however Xcode doesn't seem to understand it has to interpret the header as c++, in fact it returns an endless list of issues including "not found" errors on inclusions like theese:
#include <string>
#include <vector>
and other c++ language-specific syntax. Unfortunately changing the .h extension to .hpp doesn't solve the issue, and neither setting the file type to "C++ Header" in the Xcode file inspector does.
Any suggestion? Is there any flag I need to set somewhere to manually indicate to use g++ on the library files? Thanks.
Upvotes: 0
Views: 580
Reputation: 54
change your objectiveC-file extension from .m to .mm Clean the project then there you go
happy coding
Upvotes: 0
Reputation: 5133
You can import C++ headers only in Objective-C++ files, change your objc-file extension to .mm
.
Upvotes: 1