我正在尝试编译这个小程序:
#include <boost/math/distributions/poisson.hpp>
namespace boost { namespace math {
template <class RealType = double,
class Policy = policies::policy<> >
class poisson_distribution;
typedef poisson_distribution<> poisson;
template <class RealType, class Policy>
class poisson_distribution
{
public:
typedef RealType value_type;
typedef Policy policy_type;
poisson_distribution(RealType mean = 1); // Constructor.
RealType mean()const; // Accessor.
}
}} // namespaces boost::math
此代码取自此处。
编译器告诉我boost/math/distributions/poisson.hpp
找不到。所以,我尝试自己找到这个文件(使用locate poisson.hpp
命令)。我找到以下文件:/opt/software/boost/1.45_ubuntu12.4lts_gcc4.5.3/include/boost/math/distributions/poisson.hpp
. 因此,在我的代码中,我输入了文件的全名以确保编译器找到它:
#include </opt/software/boost/1.45_ubuntu12.4lts_gcc4.5.3/include/boost/math/distributions/poisson.hpp>
但现在我收到另一条错误消息:boost/math/distributions/fwd.hpp
未找到。
有没有办法强制编译器搜索正确目录中的文件?
我使用g++
编译器。