IOS声明提振类类变量 [英] IOS declare boost class as class variable

查看:137
本文介绍了IOS声明提振类类变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用boost库类做一些套接字通信。我需要做的声明这个变量作为类的实例,所以我宣布类似下面,

I am trying to use boost library class to do some socket communication. I need to do declare this variables as class instance, so I have declared like below,

@interface Custom_View : UIView{
    boost::asio::io_service io_service_2;
    tcp::resolver r_2(io_service_2);
    client c_2(io_service_2);
    boost::thread* dvr_thread_2;
}

获取埃罗像

Custom_View.h:46:23: Unknown type name 'io_service_2'; did you mean 'boost::asio::io_service'?
Custom_View.h:47:16: Unknown type name 'io_service_2'; did you mean 'boost::asio::io_service'?
Custom_View.h:46:19: Field 'r_2' declared as a function
Custom_View.h:47:12: Field 'c_2' declared as a function

我怎样才能解决这个错误。

How can I resolve this error.

推荐答案

如果你想声明一个Objective-C类或静态变量,你必须这样做在@interface声明中的花括号外面。例如(它的好ommit的'{}'如果你没有任何声明实例变量):

If you're trying to declare an Objective-C class or static variable, you must do it outside of the curly brackets in the @interface declaration. For example (it's okay to ommit the '{}' if you're not declaring any instance variables):

@interface SubclassName : SuperclassName

Type variableName;

话虽这么说,我不熟悉Boost库,并在code声明的变量似乎并没有有效的Objective-C。快速谷歌搜索提出了这个项目的GitHub的这可能有助于引导你在正确的方向: https://github.com/ MZ2 / boostoniphone

这篇关于IOS声明提振类类变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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