Tencent / mars

Mars is a cross-platform network component developed by WeChat.
Other
17.24k stars 3.63k forks source link

iOS STD 抽象类 虚函数没有实现 导致 demo编译不过 #901

Open sunyazhou13 opened 3 years ago

sunyazhou13 commented 3 years ago
/Users/sunyazhou/Downloads/mars/samples/iOS/iOSDemo/PublicComponentV2/stn_callback.mm:30:25: error: allocating an object of abstract class type 'mars::stn::StnCallBack'
        instance_ = new StnCallBack();
                        ^
In file included from /Users/sunyazhou/Downloads/mars/samples/iOS/iOSDemo/PublicComponentV2/stn_callback.mm:15:
In file included from /Users/sunyazhou/Downloads/mars/samples/iOS/iOSDemo/PublicComponentV2/stn_callback.h:24:
/Users/sunyazhou/Downloads/mars/samples/iOS/iOSDemo/mars.framework/Headers/stn/stn_logic.h:58:22: note: unimplemented pure virtual method 'OnTaskEnd' in 'StnCallBack'
        virtual int  OnTaskEnd(uint32_t _taskid, void* const _user_context, const std::string& _user_id, int _error_type, int _error_code, const CgiProfile& _profile) = 0;
BoxDengJZ commented 3 years ago

你把抽象类,virtual 删除,就好了。

tecent 是为了让你的业务逻辑继承,

这里有一个 demo

https://github.com/coyingcat/marsDemo

当然你还会遇到更多的问题

BoxDengJZ commented 3 years ago

博客 https://zhuanlan.zhihu.com/p/347246513

t 厂 mars , iOS 接入第一步

VoofChat commented 3 years ago

博客 https://zhuanlan.zhihu.com/p/347246513

t 厂 mars , iOS 接入第一步

后续还有研究吗,第一次对腾讯开源的框架感到非常失望,连个Demo运行起来还这么头疼,完全就是政绩工程

Jyhwenchai commented 3 years ago

@sunyazhou13 使用1.3.0版本,不要使用master

LiShiSui commented 1 year ago

博客 https://zhuanlan.zhihu.com/p/347246513

t 厂 mars , iOS 接入第一步 大佬这个demo连上之后一会就蹦了,咋回事呀?

blingmanaaaaa commented 5 months ago

我用了master的代码生成了mars.framework, 用了iosDemo里的app_callback以及stn_callback, 报错Allocating an object of abstract class type 'StnCallBack',请问有什么解决方法吗