首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在omnet++中构建项目时出错

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

Stack Overflow用户
提问于 2019-05-13 09:26:15
回答 1查看 95关注 0票数 0

在构建导入的项目时,会发生错误。我正在使用gcc版本9。

我已经成功地建立了Inet4.1。我也尝试了一些gcc版本在5到8之间,但也发生了同样的错误。

代码语言:javascript
复制
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:
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-13 09:53:36

您或任何编写头文件model/Showcase/Layer1/DummyWindPark/WindPowerGenerator.h的人都试图在该文件中使用IntType = double实例化模板template< class IntType = int >class uniform_int_distribution,编译器注意到:

代码语言:javascript
复制
In instantiation of ‘class std::uniform_int_distribution<double>’

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

代码语言:javascript
复制
 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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56109409

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档