在XCode中使用未知类型名“using”

时间:2021-06-11 19:57:24

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,就不会有任何错误。

1 个解决方案

#1


12  

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++),它应该可以正常工作。

#1


12  

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++),它应该可以正常工作。