在 omnet++ 中构建项目时出错

Errors while building a project in omnet++

构建导入的项目时出现错误。我正在使用 gcc 版本 9。

我已经成功搭建了Inet 4.1。我也用 5 到 8 之间的其他一些 gcc 版本尝试过这个,但发生了同样的错误。

main.cc
In file included from /usr/include/c++/9/bits/stl_algo.h:66,
                 from /usr/include/c++/9/algorithm:62,
                 from /home/sebastian/Downloads/omnetpp-5.4.1/include/omnetpp.h:29,
                 from main.cc:20:
/usr/include/c++/9/bits/uniform_int_dist.h: In instantiation of ‘class std::uniform_int_distribution<double>’:
model/Showcase/Layer1/DummyWindPark/WindPowerGenerator.h:53:43:   required from here
/usr/include/c++/9/bits/uniform_int_dist.h:60:49: error: static assertion failed: template argument must be an integral type
   60 |       static_assert(std::is_integral<_IntType>::value,
      |                                                 ^~~~~
In file included from model/Showcase/Layer1/Windpark/WindParkNetwork.h:21,
                 from model/Showcase/Layer1/SmartParkingScenario.h:26,
                 from main.cc:26:

你,或者写头文件的人model/Showcase/Layer1/DummyWindPark/WindPowerGenerator.h, 正在该文件中尝试实例化模板 template< class IntType = int >class uniform_int_distribution IntType = double,编译器指出:

In instantiation of ‘class std::uniform_int_distribution<double>’

double不是整数类型,模板中包含一个static_assert 要求 IntType 整数类型。因此 static_assert 在编译时失败:

 error: static assertion failed: template argument must be an integral type

整数类型是那些满足模板谓词std::is_integral

如果您或失败的作者 std::uniform_int_distribution<double> 想要生成 double 的均匀分布,那么他们应该使用 template< class RealType = double > class uniform_real_distribution