我有以下代码:
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/numeric/interval.hpp>
#include <boost/math/distributions/students_t.hpp>
using namespace boost::numeric;
using namespace interval_lib;
unsigned int len=10;
unsigned int v = len - 1;
double sqrtlen = sqrt(double(len));
students_t dist(v);
double stdev = 0.2;
double mean = 3;
double t_stat = mean * sqrtlen / stdev;
double q = cdf(complement(dist, std::fabs(t_stat)));
然而,当我编译时,我收到以下错误:
Tests.cpp:39:3: error: ‘students_t’ was not declared in this scope
Tests.cpp:39:14: error: expected ‘;’ before ‘dist’
Tests.cpp:45:31: error: ‘dist’ was not declared in this scope
Tests.cpp:45:54: error: ‘complement’ was not declared in this scope
Tests.cpp:45:55: error: ‘cdf’ was not declared in this scope
我不明白为什么当我包含适当的标题时它会抱怨。任何人都可以告诉我如何解决它。谢谢!
答案 0 :(得分:2)
答案 1 :(得分:1)
I think your namespace might be off.另一个通用指针:尽可能避免使用'using'指令,如果你有名字冲突,它们会导致一些非常难以调试的错误。