Mailing list archive (omnetpp-l at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omnetpp-l] cannot cast cMessage to cPacket


try to use cPacket * PK(cMessage  *) to cast cMessage to cPacket.


On Tue, Apr 7, 2009 at 10:42 AM, Vitali Anselm <VitaliAnselm at xxx> wrote:

I use some functions like getByteLength() in my handleMessage(cMessage *msg)  function, so I decided to cast msg to cPacket to be able to use these functions. For this I wrote the following code:

cPacket *tempPtr = check_and_cast<cPacket *>(msg);

and then I use tempPtr at places, where the cPacket functions are called.

When I compile all, there is no errors, but when I want to run TKenv there is
 the following error:

 Error in module(.....):
 check_and_cast():cannot cast (cMessage*).......[0].per_second_timer to type

per_second_timer is declared as cMessage:

per_second_timer = new cMessage("per_second_timer");
       scheduleAt(simTime(), per_second_timer);

Can you help me?


Psssst! Schon vom neuen WEB.DE MultiMessenger gehört?
Der kann`s mit allen:

Omnetpp-l mailing list
Omnetpp-l at xxx

Omnetpp-l mailing list
Omnetpp-l at xxx

Home | Main Index | Thread Index