在 Omnet++ 中,c++ 认为变量是一个函数

in Omnet++, c++ thinks variable is a function

本文关键字:函数 一个 变量 Omnet++ c++      更新时间:2023-10-16

我正在使用Omnet++并编写C++代码。我的文件中有以下声明:

channel Link extends ned.DatarateChannel
{
    datarate = 16Gbps; // 32 lines of 2ns clock
    delay = 0us;
}

在我的模块的 .cc 文件中,我正在编写以下函数:

void InPortAsync::getErrorTimeout(int sx, int sy, int rx, int ry, int dx, int dy, int &routerType, simtime_t &timeout)
{   // find the flight time for packet from this node to the next joint node = TTL in queue
    int dir0 =-1;
    int dir1 =-1;
    int temprx = -1;
    int tempry = -1;
    int outPort = -1;
    int destRouterType, destTimeout;
    Link* temp_Channel;
    ...
}

很明显,我正在声明一个名为 temp_Channel 的 Link 对象的指针。但是,编译器返回以下错误:在此范围内未声明"temp_Channel"

为什么海湾合作委员会不理解我的声明?

提前感谢!

在 NED 文件中声明Link通道与C++代码无关。它不会生成任何标头或C++可以包含在代码中的类。事实上,NED文件只在运行时处理,而不是在编译时处理。

相关文章: