gpt4 book ai didi

c++ - 开放网络 : wrote a function in process model of opnet but has error

转载 作者:行者123 更新时间:2023-12-02 11:04:27 24 4
gpt4 key购买 nike

我正在用 opnet 模拟网络协议(protocol)。在流程 block 的流程模型中,我在 FB 中编写了此函数。但是在编译它时,给了我:

error: function 'inrpt_timer' must return a value;

但它正在返回“intrpt”。我很困惑!还有另一个问题:我不知道为什么我应该把静态放在函数定义的前面。我只是把它放了,因为预定义的函数也有它。也许问题出在那个!这是代码:
static int intrpt_timer()
{
int intrpt;

FIN(intrpt_timer());

if((op_sim_time()-last_time)>=Ts) //check for interrupt
{
intrpt=1;//1 is true
last_time=op_sim_time(); //if timer passed update last time value
}
else
intrpt=0;//zero is false


return intrpt;
FOUT;

}

最佳答案

哈哈,自己找的;

当想要返回一个值时,(在 opnet 中)“FRET(value);”替换“返回值;”

关于c++ - 开放网络 : wrote a function in process model of opnet but has error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21597377/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com