简体   繁体   中英

Errors while building a project in omnet++

While building of an imported project, an errors occurs. I am using gcc Version 9.

I have already built Inet 4.1 successfully. I also tried this with some other gcc Version between 5 and 8, but the same errors occured.

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:

You, or whoever wrote the header file model/Showcase/Layer1/DummyWindPark/WindPowerGenerator.h , is attempting in that file to instantiate the template template< class IntType = int >class uniform_int_distribution with IntType = double , as the compiler notes:

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

double is not an integral type, and the template contains a static_assert requiring that IntType is an integral type. So that static_assert fails as compiletime:

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

Integral types are are those that satisfy the template predicate std::is_integral .

If you or the author of the failing std::uniform_int_distribution<double> want to generate a uniform distribution of double then they should use template< class RealType = double > class uniform_real_distribution

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM