[C++-sig] object constructor + integer == fail

Daniel Löb loeb at fkp.tu-darmstadt.de
Tue Oct 13 16:19:02 CEST 2009


troy d. straszheim wrote:
> Daniel Löb wrote:
>> Hi!
>>
>> I seem to be unable to call the constructor of "object" with an 
>> integer parameter.
>> Working example:
>>
>> #include <boost/python.hpp>
>> #include <iostream>
>>
>> using namespace boost::python;
>> using std::cout;
>> using std::endl;
>>
>> int main()
>> {
>>     object toast(3);
>>     cout << extract<int>(toast) << endl;
>> }
>>
>> It compiles just fine, but dies with a segmentation fault on execution 
>> of the first line within main.
>>
> 
> Does calling Py_Initialize() help?
> 
Yes, that did it.

Thank you!

Best regards,
Daniel


More information about the Cplusplus-sig mailing list