5

I am trying to use boost::units in a project but am running into trouble.

I have a template class which has some quantity objects as members. In one I wish to store a value with dimensions of pressure so I have quantity<pressure> press; declared as a member variable.

However this gives an error saying that quantity expects two template arguments (the source code shows the second template argument should default to double). If I then specify quantity<pressure,double> press; I instead get an error which says

  • error: field ‘press’ has incomplete type.

Am I doing something wrong or is there a problem with the implementation of pressure somehow?

Minimal Example:

#include <boost/units/dimension.hpp>
#include <boost/units/systems/si/pressure.hpp>

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

struct MyClass
{
    quantity<pressure,double> press;    
};

Details:

  • Boost 1.54.0
  • g++ 4.7.3
Dan
  • 12,857
  • 7
  • 40
  • 57

1 Answers1

4

I believe you need to include this:

#include <boost/units/quantity.hpp>

Coliru

  • Thanks, I just figured this out too. Such a rookie error. So is there a `quantity` object in .../dimension.hpp too? – Dan Nov 18 '13 at 13:40
  • @Dan Not sure, but I simply looked at the example file they had to see what headers were necessary. –  Nov 18 '13 at 14:14