[英]IOS declare boost class as class variable
I am trying to use boost library class to do some socket communication. 我正在尝试使用Boost库类进行一些套接字通信。 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;
}
Getting erro like 越来越像
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. 我该如何解决此错误。
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. 如果要声明一个Objective-C类或静态变量,则必须在@interface声明中的大括号之外进行操作。 For example (it's okay to ommit the '{}' if you're not declaring any instance variables):
例如(如果您不声明任何实例变量,可以省略“ {}”):
@interface SubclassName : SuperclassName
Type variableName;
That being said, I'm not familiar with the boost library, and the variables declared in your code do not appear to be valid Objective-C. 话虽如此,我对boost库并不熟悉,并且在代码中声明的变量似乎不是有效的Objective-C。 A quick Google search brought up this GitHub project which may help lead you in the right direction: https://github.com/mz2/boostoniphone
Google的快速搜索提出了这个GitHub项目,它可以帮助您朝正确的方向发展: https : //github.com/mz2/boostoniphone
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.