Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8248643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:15:30+00:00 2026-06-07T23:15:30+00:00

I am trying to compile my code using libboost library, by putting #include <boost/python.hpp>

  • 0

I am trying to compile my code using libboost library, by putting #include <boost/python.hpp> in my C++ code. Could somebody please help me the right command to run this, especially to include and link the library. I’m pretty basic in this.

The command used(but not working):

g++ try.cpp -L /usr/lib/libboost_python.so -o try

EDIT:

The tested code:

#include <boost/python.hpp>
#include <iostream>

int main() 
{

    std::cout << "Yes, it works :-)" << std::endl;

    return 0;
}

Error messages:

from try.cpp:1:
/usr/include/boost/python/enum.hpp:31: error: expected ‘;’ before ‘*’ token
/usr/include/boost/python/enum.hpp:32: error: expected ‘;’ before ‘(’ token
/usr/include/boost/python/enum.hpp:33: error: ‘PyObject’ has not been declared
/usr/include/boost/python/enum.hpp:52: error: expected constructor, destructor, or     type conversion before ‘*’ token
/usr/include/boost/python/enum.hpp:67: error: ‘void*       boost::python::enum_<T>::convertible_from_python’ is not a static member of ‘struct     boost::python::enum_<T>’
/usr/include/boost/python/enum.hpp:67: error: template definition of non-template ‘    void* boost::python::enum_<T>::convertible_from_python’
/usr/include/boost/python/enum.hpp:67: error: ‘PyObject’ was not declared in this     scope
/usr/include/boost/python/enum.hpp:67: error: ‘obj’ was not declared in this scope
    /usr/include/boost/python/enum.hpp:80: error: variable or field ‘construct’     declared void 
/usr/include/boost/python/enum.hpp:80: error: ‘PyObject’ was not declared in this     scope
/usr/include/boost/python/enum.hpp:80: error: ‘obj’ was not declared in this scope
/usr/include/boost/python/enum.hpp:80: error: expected primary-expression before ‘*’ token
/usr/include/boost/python/enum.hpp:80: error: ‘data’ was not declared in this scope

Another thing is that when I compile g++ -Wall thread_one.cpp -o thread_one -lboost_thread, that works in order to use boost_thread library.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:15:33+00:00Added an answer on June 7, 2026 at 11:15 pm

    Finally, it is working. The command used is as below:

    g++ -I/usr/include/python2.6 try.cpp -o try -lboost_python -lpython2.6

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to compile this code: #include <iostream> #include <vector> using namespace std; class
I am trying to compile the following code on Linux using gcc 4.2: #include
I'm trying to compile python source code foo.py to C using cython . In
I'm trying to compile such code: #include <iostream> using namespace std; class CPosition {
I am trying to compile my gcc code using the following make command .
I am trying to compile my piece of code using make. Normally I compile
I am trying to compile code that works on os x and linux using
I am trying to compile an old C++ software project in Code::Blocks using the
I'm trying to port code over to compile using Microchip's C18 compiler for a
I am trying to compile a code that uses Boost's zlib wrappers. However, no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.