Reputation: 47
I am learning omnet++ to simulate a network. The code in packeage.ned is shown as follows:
package helloworld.simulations;
import inet.networklayer.configurator.ipv4.FlatNetworkConfigurator;
import inet.node.inet.Router;
import inet.node.inet.StandardHost;
@license(LGPL);
network Network
{
@display("bgb=519,314");
submodules:
Client: StandardHost {
@display("p=82,217");
}
router: Router {
@display("p=218,117");
}
Server: StandardHost {
@display("p=361,198");
}
flatNetworkConfigurator: FlatNetworkConfigurator {
@display("p=296,46;b=45,44");
}
connections:
Client.ethg++ <--> router.ethg++;
router.ethg++ <--> Server.ethg++;
}
And the code in omnetpp.ini is shown as follows:
[General]
network = helloworld.simulations.Network
**.Client.numTcpApps = 1
**.Client.tcpApp[0].typename = "TCPBasicClientApp"
**.Client.tcpApp[0].connectAddress = "Server"
**.Client.tcpApp[0].connectPort = 80
**.Client.tcpApp[0].thinkTime = 0s
**.Client.tcpApp[0].idleInterval = 0s
**.Server.numTcpApps = 1
**.Server.tcpApp[0].typename = "TCPEchoApp"
**.Server.tcpApp[0].localPort = 80
**.ppp[*].queueType = "DropTailQueue"
**.ppp[*].queue.frameCapacity = 10
However, when I run this program, I encounter the following problem:enter image description here
Now, I do not how to solve this problem. Thank you for your help!
Upvotes: 0
Views: 1394
Reputation: 7002
Have you built INET
? If yes, go to the mingw
console and type:
opp_run -h nedfunctions -l /d/omnetpp-5.1.1/Projects/inet/src/inet | grep firstAvailableOrEmpty
After -l there is a path to your libINET.dll file
. You should see something like:
firstAvailableOrEmpty : string firstAvailableOrEmpty(...)
Accepts any number of strings, interprets them as NED type names (qualified or unqualified), and returns the first one that exists and its C++ implementation class is also available. Returns empty string if none of the types are available.
Moreover, the instance of FlatNetworkConfigurator
must be called configurator
, not flatNetworkConfigurator
.
EDIT
Go to INET
properties then select OMNeT++
| Makemake
| select src
| Options...
| Compile
tab | More >>
and ensure that you have set Export include path for other projects
and Force compiling object files for use in DLLs
. And in Target
tab set Export this shared/static library for other projects
. Then rebuild INET
.
Then in your project:
Properties
| Project References
make sure that inet
is selected.Properties
| OMNeT++
| Makemake
| select directory with source files | Options...
| Compile
and make sure that the following options are checked:
Add include paths exported from referenced projects
Add include dir and other compile options from enabled project features
In Properties
| OMNeT++
| Makemake
| select directory with source files | Options...
| Link
and make sure that the following options are checked:
Link with libraries exported from referenced projects
Add libraries and other linker options from enabled project features
Rebuild your project.
Upvotes: 1