Results 1 to 3 of 3

Thread: help with boost libraries

  1. #1
    Join Date
    Dec 2007
    Beans
    56

    help with boost libraries

    I recently downloaded the boost v1.39 libraries for some projects of mine. I wanted to test the incomplete gamma function, which is supposed to be gamma_p.

    The following is my code snippet :
    Code:
    #include <iostream>
    #include <boost/math/special_functions/gamma.hpp>
    using namespace std;
    
    int main() {
            cout << gamma_p(2,1) << endl;
    return 0;
    }
    The boost libraries are installed in /opt/boost. The command I used to compile this program was :
    Code:
    g++ gammainc.cpp -I /opt/boost/include/boost-1_39/ -L /opt/boost/lib/ -lboost_math_c99f-gcc43-mt-1_39
    I got the following error :
    Code:
    gammainc.cpp: In function ‘int main()’:
    gammainc.cpp:7: error: ‘gamma_p’ was not declared in this scope
    The include files are located in /opt/boost/include/boost-1_39/boost/math/special_functions/ (in this case, the file gamma.hpp)

    Now, the gamma.hpp header seems to contain the definition of gamma_p, but somehow, I am unable to get it to work. The library which I am using is libboost_math_c99f-gcc43-mt-1_39.so. What exactly is the problem?

  2. #2
    Join Date
    Oct 2007
    Beans
    1,914
    Distro
    Lubuntu 12.10 Quantal Quetzal

    Re: help with boost libraries

    Quote Originally Posted by darthshak View Post
    What exactly is the problem?
    Boost functions are in the boost namespace. Try referencing to your function as "boost::gamma_p".

  3. #3
    Join Date
    Dec 2007
    Beans
    56

    Re: help with boost libraries

    Boost functions are in the boost namespace. Try referencing to your function as "boost::gamma_p"
    It completely slipped my mind...thanks a lot! Problem solved.

    For the record, it turned out to be boost::math::gamma_p

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •