2017-09-01 30 views
0

我與Wikitude SDK工作,同時增加在Wikitude支持例如,某些文件夾的顯示我Foundation文件錯誤,如下面。得到錯誤,而使用ObjC類包括在.cpp文件(不合格-ID @class)

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;

沒有得到什麼錯在這裏,但它說,

所有NSStringNSObjectNSLog不合格-ID @class

我設置了所有相關的鏈接器標誌和與標題&圖書館serch路徑,但仍然出現以上錯誤。

任何人都可以指導我在這有什麼問題嗎?

錯誤的屏幕截圖以供參考:

enter image description here

先謝謝了!

+1

你想在文件中使用Obj-C類嗎?如果是這樣,將文件結尾改爲'.mm'以使用Obj-C++編譯器。 – Mats

+0

是的,我有一些類與cpp ext但奇怪的是,同樣的.cpp ext工作在Wikitude演示,但是當我想創建新的演示它拋出以上錯誤。 – CodeChanger

回答

0

對於上述問題,我很努力,最後我用下面的解決方案得出結論。

  • 要使用.cpp文件中ObjC我們需要的是.cpp擴展轉換爲.mmObjC++編譯器。 (感謝Mats對你的評論幫助我很多。)
  • 編譯源代碼爲ObjectiveC++在Build設置中。

參考鏈接1:Objective-C++ and .cpp files in Xcode

參考鏈接2:Adding C++ code to an iOS project

希望這將幫助其他人誰正面臨着與.CPP分機同樣的問題。

謝謝。