initialize method in TraCIDemoRSU11p

南楼画角 提交于 2019-12-11 19:07:29

问题


I'm using omnetpp-5.4.1 , veins-4.7.1 , sumo-0.30.0 .I'm going to do fuzzy clustering by RSU in veins.I created a new module called FCM in veins/modules/application/traci and inherited the TraCIDemo11p and wrote the clustering code in it. Because I want to RSU start clustering,I used the initialize method in the TraCIDemoRSU11p to call the method inside the FMC at the start of work.

    void TraCIDemoRSU11p::initialize(int stage) {
    BaseWaveApplLayer::initialize(stage);

    std::cout<<"starting clustering";
    FCM * fcm_clustering;
    fcm_clustering->clustering();


}

When I run the program, it is not allowed to run at the start of the program, saying "finish with error" and the program stops running. What can I do to call the clustering by RSU at the beginning of the simulation?

please help me to solvemy problem. Thanks.


回答1:


You have defined a pointer fcm_clustering but you didn't initialize it. Therefore an attempt to use it ends up with memory violation.
Try to create FCM object, for example:

FCM * fcm_clustering = new FCM();


来源:https://stackoverflow.com/questions/57933719/initialize-method-in-tracidemorsu11p

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!