Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io.hpp is required to compile vector of dimensioned types #60

Open
NAThompson opened this issue Feb 10, 2024 · 2 comments
Open

io.hpp is required to compile vector of dimensioned types #60

NAThompson opened this issue Feb 10, 2024 · 2 comments

Comments

@NAThompson
Copy link

To reproduce:

#include <vector>
#include <boost/units/systems/si/length.hpp>
// Uncomment to fix:
//#include <boost/units/systems/si/io.hpp>

using namespace boost::units;
using namespace boost::units::si;

auto dimensioned_sphere(std::vector<quantity<length>> const & v) {
  return v[0];
}

int main()
{
    return 0;
}

Compile error:

main.cpp:9:10: fatal error: implicit instantiation of undefined template 'boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::length_base_dimension, boost::units::static_rational<1>>, boost::units::dimensionless_type>, boost::units::homogeneous_system<boost::units::list<boost::units::si::meter_base_unit, boost::units::list<boost::units::scaled_base_unit<boost::units::cgs::gram_base_unit, boost::units::scale<10, static_rational<3>>>, boost::units::list<boost::units::si::second_base_unit, boost::units::list<boost::units::si::ampere_base_unit, boost::units::list<boost::units::si::kelvin_base_unit, boost::units::list<boost::units::si::mole_base_unit, boost::units::list<boost::units::si::candela_base_unit, boost::units::list<boost::units::angle::radian_base_unit, boost::units::list<boost::units::angle::steradian_base_unit, boost::units::dimensionless_type>>>>>>>>>>>>'
    9 |   return v[0];
      |          ^
~/boost/boost/units/units_fwd.hpp:52:45: note: template is declared here
   52 | template<class Unit,class Y = double> class quantity;
      |                                             ^
1 error generated.

Error on top of 4578701.

@correaa
Copy link

correaa commented Feb 10, 2024

no, you need to include (more basically) boost/units/quantity.hpp.

and this is probably by design.

@NAThompson
Copy link
Author

Ok, I got this by paring down the MWE so maybe that needs to include quantity.hpp . . .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants