Reputation: 19
I am trying to setup boost library on my eclipse. I have Windows 7 Eclipse Luna Boost 1.59 Mingw
I have already compile boost library with the b2 command. I also added the library in Paths and Symbols for my project. In the minGW linker I have the "boostdir"\stage\lib path for the -L options. In the -l options I tried a lot of combination of -boost_filesystem -boost_system -boost -...
Here is the problem:
#include<iostream>
#include <boost/math/distributions/chi_squared.hpp>
int main() {
double pvalue = 2.667;
boost::math::chi_squared_distribution aDist(1);
pvalue = boost::math::cdf(aDist,pvalue);
std::cout << "The p-value is : "<<pvalue << std::endl;
return 0;
}
The compiler gives me :
16:24:25 **** Incremental Build of configuration Debug for project test2 ****
Info: Internal Builder is used for build
g++ "-IC:\\MinGW\\boost_1_59_0" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\test2.o" "..\\src\\test2.cpp"
..\src\test2.cpp: In function 'int main()':
..\src\test2.cpp:6:40: error: missing template arguments before 'aDist'
boost::math::chi_squared_distribution aDist(1);
^
..\src\test2.cpp:6:40: error: expected ';' before 'aDist'
..\src\test2.cpp:7:28: error: 'aDist' was not declared in this scope
pvalue = boost::math::cdf(aDist,pvalue);
^
16:24:28 Build Finished (took 3s.531ms)
The second error is ok since it is cause by line 6. But the auto completion of eclipse works so he can somehow see the library!
Where is the error coming from?
Upvotes: 0
Views: 111
Reputation: 227418
boost::math::chi_squared_distribution
is a class template. You need to provide a template parameter for it. For exampe,
boost::math::chi_squared_distribution<some_floating_point_type> mydist(1);
Upvotes: 1