XCode 中的未知类型名称“使用”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17366987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:33:34  来源:igfitidea点击:

Unknown type name 'using' in XCode

c++iosxcodenamespacesobjective-c++

提问by poiuytrez

I have a project (MyLib) inside my main project (MainApp). When I build the MainApp, XCode gives me an error in one of the .h file of MyLib:

我的主项目 (MainApp) 中有一个项目 (MyLib)。当我构建 MainApp 时,XCode 在 MyLib 的 .h 文件之一中给我一个错误:

using namespace cv;

The error message is:

错误信息是:

Unknown type name 'using' 

If I build MyLib alone, I do not have any error.

如果我单独构建 MyLib,我没有任何错误。

回答by trojanfoe

I expect that header file is included from a .m(Objective-C) file?

我希望头文件包含在.m(Objective-C)文件中?

Change the extension to .mm(Objective-C++) and it should work fine.

将扩展名更改为.mm(Objective-C++),它应该可以正常工作。