2012-03-14 2 views
0

나는 다음과 같은 코드를 가지고 : 내가 컴파일 할 때부스트 Student_t는 분배

#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 

이해가 안가 왜 불평 적절한 헤더가 포함되어 있습니다. 아무도 그것을 고칠 방법을 말해주십시오. 감사!

답변

2

좋은 네임 스페이스가 포함되지 않았기 때문에.

So, for example, the Students-t distribution template in namespace boost::math is

Link here

+0

감사합니다. 이름 공간 boost :: math가 없습니다. 그걸 고정 – user1155299

+0

@ user1155299 :이 경우 당신은이 대답을 받아 들여야합니다. – Mankarse

1

I think your namespace might be off. 또 다른 일반적인 포인터 : 다음 문서에서 당신은 이름 충돌이있는 경우 가능하면 지침 '을 사용하여'피하십시오, 그들은 정말 어려운 디버그 오류가 발생할 수 있습니다.

+0

감사합니다. boost :: 수학으로 해결했습니다. – user1155299

관련 문제