I am following the tictoc tutorial and I want to change the code of tictoc12 so that I'll get the index of the gate from which we received the message so that the message will not send out from the same gate. This is my handleMesssage() function:
void Txc12::handleMessage(cMessage *msg)
{
if (getIndex() == 3) {
// Message arrived.
EV << "Message " << msg << " arrived.\n";
delete msg;
}
else {
int arrivalGate = msg->getArrivalGate()->getIndex();
EV << "arrival gate: " << arrivalGate << "\n";
// We need to forward the message.
forwardMessage(msg);
}
}
and this is the error that i receive:
Simulation terminated with exit code: -1073741819 Working directory: D:/omnetpp-5.6.1/samples/tictoc Command line: tictoc.exe -m -u Qtenv omnetpp.ini
Environment variables: PATH=;D:\omnetpp-5.6.1\bin;D:\omnetpp-5.6.1\tools\win64\mingw64\bin;D:\omnetpp-5.6.1\tools\win64\usr\bin;;D:/omnetpp-5.6.1/ide/jre/bin/server;D:/omnetpp-5.6.1/ide/jre/bin;D:/omnetpp-5.6.1/ide/jre/lib/amd64;.;D:\omnetpp-5.6.1\bin;D:\omnetpp-5.6.1\tools\win64\mingw64\bin;D:\omnetpp-5.6.1\tools\win64\usr\local\bin;D:\omnetpp-5.6.1\tools\win64\usr\bin;D:\omnetpp-5.6.1\tools\win64\usr\bin;C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;D:\omnetpp-5.6.1\tools\win64\usr\bin\site_perl;D:\omnetpp-5.6.1\tools\win64\usr\bin\vendor_perl;D:\omnetpp-5.6.1\tools\win64\usr\bin\core_perl;D:\omnetpp-5.6.1; OMNETPP_ROOT=D:/omnetpp-5.6.1/ OMNETPP_IMAGE_PATH=D:\omnetpp-5.6.1\images
Does anyone know what I'm doing wrong?
The value of exit code -1073741819
is equal to 0xC0000005
- an access violation. However, handleMessage()
presented by you cannot be source of that error.
I strongly suggest using debugger to find the lines that cause that error. To do this:
Compile your project in debug mode.
In your omnetpp.ini
set:
debug-on-errors = true
Start your simulation in debug (i.e. Run
| Debug
)
The execution of the simulation will stop just before the line that causes an exception.
Reference: TicToc Tutorial - 2.3 Debugging