teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

追加

2017/08/31 05:33

投稿

hatana25
hatana25

スコア13

title CHANGED
@@ -1,1 +1,1 @@
1
- ファイルが実行されない
1
+ ns3でファイルが実行されない
body CHANGED
@@ -14,4 +14,86 @@
14
14
 
15
15
  このエラーの解決方法を教えてください。
16
16
 
17
- よろしくお願い致します。
17
+ よろしくお願い致します。
18
+
19
+
20
+ 追加:
21
+ 当該コードですが、今までコンパイルできていたコードすべてがコンパイルできなくなりました。
22
+ 例えば下記のようなコードです。
23
+
24
+ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25
+ /*
26
+ * This program is free software; you can redistribute it and/or modify
27
+ * it under the terms of the GNU General Public License version 2 as
28
+ * published by the Free Software Foundation;
29
+ *
30
+ * This program is distributed in the hope that it will be useful,
31
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
32
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33
+ * GNU General Public License for more details.
34
+ *
35
+ * You should have received a copy of the GNU General Public License
36
+ * along with this program; if not, write to the Free Software
37
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38
+ */
39
+
40
+ #include "ns3/core-module.h"
41
+ #include "ns3/network-module.h"
42
+ #include "ns3/internet-module.h"
43
+ #include "ns3/point-to-point-module.h"
44
+ #include "ns3/applications-module.h"
45
+
46
+ using namespace ns3;
47
+
48
+ NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");
49
+
50
+ int
51
+ main (int argc, char *argv[])
52
+ {
53
+ Time::SetResolution (Time::NS);
54
+ LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
55
+ LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
56
+
57
+ NodeContainer nodes;
58
+ nodes.Create (2);
59
+
60
+ PointToPointHelper pointToPoint;
61
+ pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
62
+ pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
63
+
64
+ NetDeviceContainer devices;
65
+ devices = pointToPoint.Install (nodes);
66
+
67
+ InternetStackHelper stack;
68
+ stack.Install (nodes);
69
+
70
+ Ipv4AddressHelper address;
71
+ address.SetBase ("10.1.1.0", "255.255.255.0");
72
+
73
+ Ipv4InterfaceContainer interfaces = address.Assign (devices);
74
+
75
+ UdpEchoServerHelper echoServer (9);
76
+
77
+ ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));
78
+ serverApps.Start (Seconds (1.0));
79
+ serverApps.Stop (Seconds (10.0));
80
+
81
+ UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);
82
+ echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
83
+ echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.0)));
84
+ echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
85
+
86
+ ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
87
+ clientApps.Start (Seconds (2.0));
88
+ clientApps.Stop (Seconds (10.0));
89
+
90
+ Simulator::Run ();
91
+ Simulator::Destroy ();
92
+ return 0;
93
+ }
94
+
95
+ コマンドは
96
+ ./waf --run "first"
97
+ です。
98
+
99
+ このコマンドでコンパイルしましたができなくなりました。