In OMNET++, trying to implement a very simple ned file, I get syntax error, unexpected ':', expecting NAME after gates:

huangapple go评论52阅读模式
英文:

In OMNET++, trying to implement a very simple ned file, I get syntax error, unexpected ':', expecting NAME after gates:

问题

这是我的简单ned文件:

simple Txc1
{
   gates: (***)
    input: in;
    output: out;
}

network Tictoc1
{
  submodules:
    tic: Txc1;
    toc: Txc1;
    
  connections:
    tic.out --> { delay= 100 ms; } --> toc.in;
    tic.in <-- { delay= 100 ms; } <-- toc.out; 
}

我从一个Udemy课程中精确地复制了这段代码,以实现我的第一个项目。在标有***的行上出现错误:

语法错误,意外的': ',期望名称

在教程视频中,gates后面没有“name”,它可以正常工作。我使用的是版本5.7,而他们使用的是版本5.6。

英文:

This is my simple ned file:

simple Txc1
{
   gates: (***)
    input: in;
    output: out;
}

network Tictoc1
{
  submodules:
    tic: Txc1;
    toc: Txc1;
    
  connections:
    tic.out --&gt; { delay= 100 ms; } --&gt; toc.in;
    tic.in &lt;-- { delay= 100 ms; } &lt;-- toc.out; 
}

I copied this exactly from a udemy course, to implement my first project. I get an error at the line marked with ***:
> syntax error, unexpected ':', expecting NAME

In the tutorial video the code does not have a "name" after gates and it works fine. Im using version 5.7 while they used version 5.6

答案1

得分: 1

移除inputoutput后面的分号,即:

gates:
  input in
  output out
英文:

Remove semicolons after input and output i.e.

gates:
  input in;
  output out;

huangapple
  • 本文由 发表于 2023年3月3日 22:56:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75628613.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定