[C++-sig] Building boost::python on Ubuntu - now linking problem

Simon Pickles sipickles at hotmail.com
Tue Jan 8 14:22:19 CET 2008



Stefan Seefeld wrote:
> Simon Pickles wrote:
>   
>> Yes, sorry, good point!
>>
>> Strangely, boost::python was very simple to set up on my home ubuntu box 
>> last night.
>>
>> At work (identical os), I still have the problem as soon as I include 
>> <boost/python.hpp>. Its like I have not linked to the python API, but 
>> from my command line below, you can see I have.
>>
>> Heres is my extensive program:
>>
>> #include  <boost/python.hpp>
>>
>> int main()
>> {
>>     return 0;
>> }
>>
>>
>> Here is my output, embeddedTest is simply the name of my project :
>>
>> *-------------- Build: Debug in embeddedTest ---------------*
>> g++ -L/usr/local/boost_1_34_1/stage/lib -o bin/Debug/embeddedTest 
>> obj/Debug/main.o -lpthread -lpython2.5
>>     
>
> What happens if you "#include <python.h>" instead of <boost/python.hpp>
> above ? If you are using boost.python, you should also link with
> -lboost_python (careful to put prerequisite libs after depending libs in
> the command line !). May be that would resolve the symbols ?
>
> One possible reason for you seeing two different behaviors might be how
> boost (and boost.python, in particular) was compiled.
>
> Regards,
> 		Stefan
>
>   
Well, trying #include <python.h> fails, it is not found on my system.

Strangely, Python.h is, however I think adding -lboost_python has fixed it!

Thank you so much stefan!

I hope I am not set to bug you again too soon!

Simon

-- 
Linux Counter: User# 424693 






More information about the Cplusplus-sig mailing list