4

I am working with Wikitude SDK and while adding some file supported in Wikitude example folder its showing me Foundation file error like below.

In file included from /Volumes/DATA/Dhanesh/Projects/experiments/AR/ARWikiDemo/ARWikiDemo/WikiSDK/Controller/Examples/Categories/PluginsAPI/CustomCamera/YUVFrameInputPlugin.cpp:11: In file included from /Volumes/DATA/Dhanesh/Projects/experiments/AR/ARWikiDemo/ARWikiDemo/WikiSDK/Controller/Examples/Categories/PluginsAPI/CustomCamera/WTDeviceCamera.h:9: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:492:1: error: expected unqualified-id @class NSString, Protocol;

Not getting whats wrong here but it says that

All NSString, NSObject, NSLog are unqualified-id @class

I have set all related Linker flag and Header & Library search paths for that but still getting the above error.

Can anyone guide me on this whats going wrong here?

Error Screenshot for reference:

enter image description here

Thanks in Advance!

CodeChanger
  • 7,953
  • 5
  • 49
  • 80
  • 1
    Do you want to use Obj-C classes in the file? If so, change the file ending to `.mm` to use the Obj-C++ compiler. – Mats Sep 01 '17 at 15:14
  • Yes I have some classes with.cpp ext but strange thing is that the same .cpp ext working in Wikitude demo but while I want to create new demo its throwing above error. – CodeChanger Sep 04 '17 at 05:36

1 Answers1

5

For the Above issue, I struggle a lot, and finally, I am concluding this with the below solution.

  • To use .cpp file in ObjC we required to convert that .cpp extension to .mm for ObjC++ compiler only. (thanks Mats for your comment it's helped me a lot.)
  • Compile the source as ObjectiveC++ in the Build setting.

Ref Link 1: Objective-C++ and .cpp files in Xcode

Ref Link 2: Adding C++ code to an iOS project

Hope this will help others who are facing the same issue related to it.CPP ext.

Thanks.

CodeChanger
  • 7,953
  • 5
  • 49
  • 80