在 ns3 中声明 GnuplotHelper 失败

Declaring GnuplotHelper failed in ns3

我想使用 GnuplotHelper in ns3 to plot the results. even when I run ns3's default example seventh.cc 我收到以下错误:

../scratch/congestion.cc: In function ‘int main(int, char**)’:
../scratch/congestion.cc:173:1: error: ‘GnuplotHelper’ was not declared in this scope
 GnuplotHelper plotHelper;
 ^
../scratch/congestion.cc:180:1: error: ‘plotHelper’ was not declared in this scope
 plotHelper.ConfigurePlot ("Test","CongestionWindow vs. Time","Time (Seconds)","CongestionWindow","jpg");
 ^
../scratch/congestion.cc:181:81: error: ‘GnuplotAggregator’ has not been declared
 plotHelper.PlotProbe (probeName,probeTrace,"CongetionWindow","CongestionWindow",GnuplotAggregator::KEY_BELOW);

如果我包含“gnuplot-helper.h”,我会得到一个额外的行和同样的错误:

../scratch/seventh.cc:24:28: fatal error: gnuplot-helper.h: No such file or directory
compilation terminated.

我已经在 linux 上安装了 gnuplot。我应该怎么办?我如何声明 Gnuplot 助手?

首先,您是安装了 gnu-plot-dev 软件包还是只安装了 gnuplot?许多发行版将使用库的能力和针对它们开发的能力分开。

如果您确定包含文件确实在您系统的某处(同时检查 /usr/include 和 /usr/local/include/),您可能需要在编译器搜索路径中添加一个额外的目录级别(也许/usr/include/gnuplot/ 但我只是在猜测。

尝试

#include "ns3/stats-module.h"