非会员申请 [英] Request for member which is of non-class

查看:123
本文介绍了非会员申请的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我想使用的C ++类,它包含头文件中的所有代码,而不是CPP文件。我试图从一个继承UIViewController类的目标C文件调用它。我已将文件重命名为.mm并导入C ++文件的头文件。当我编译时,我不断得到一个编译时错误,当我尝试和访问一个方法从C ++类说请求成员'<方法>'在'< objectName& -class type'< C ++ class name>'。我做了一个搜索,似乎头是通常的问题,但我已经包括在我的文件头。还有什么可以吗? (我可以包括通用代码,如果需要,但我不知道是否允许显示实际代码,因为它属于第三方)。

I've got a C++ class I want to use which has all the code in the header file, rather than the CPP file. I'm trying to call it from an objective-C file which inherits a UIViewController class. I've renamed the file to .mm and imported the header file for the C++ file. When I compile, I keep getting a compile-time error when I try and access a method from the C++ class saying Request for member '<method>' in '<objectName>' which is of non-class type '<C++ class name>'. I did a search and it seemed that the header was usually the issue, but I've included the header in my file. What else could it be? (I can include generic code if required, but the I'm not sure if I'm allowed to show the actual code since it belongs to a third party).

推荐答案

我不是一个C ++编码器,所以这可能是一个明显的错误,但如果任何人遇到类似的问题,我只是改变了我的代码:

I'm not a C++ coder, so this was probably an obvious mistake, but if anyone else comes across a similar problem, I simply changed my code from:

myObject.method();

myObject->method();

这篇关于非会员申请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆