I'm having trouble getting a simple boost::python sample program to work properly on Linux. It compiles and seems to link properly, but the Python interpreter is unable to call my C++ function. On Mac OS X the program works as expected.
Any help would be appreciated, hopefully I'm missing something obvious. The program output is: -- BEGIN -- Traceback (most recent call last): File "<string>", line 1, in <module> Boost.Python.ArgumentError: Python argument types in Test.test(int) did not match C++ signature: test(int) -- END -- Here is the code. It's compiled and linked using "g++ -I/usr/include/python2.5 -lpython2.5 -lboost_python -Wall -o test test.cpp". On the Linux box I'm using boost-1.37.0 and python-2.5.2. -- BEGIN -- #include <stdlib.h> #include <string> #include <boost/python.hpp> using namespace boost::python; /* g++ -I/usr/include/python2.5 -lpython2.5 -lboost_python -Wall -o test test.cpp */ int test(int i) { fprintf(stderr, "%s:\n", __FUNCTION__); return i * 5; } BOOST_PYTHON_MODULE(Test) { using namespace boost::python; def("test", test); } int main(int argc, char *argv[]) { Py_Initialize(); try { initTest(); PyRun_SimpleString("import Test"); PyRun_SimpleString("print 'calling test function'"); PyRun_SimpleString("print Test.test(5)"); } catch (boost::python::error_already_set) { PyErr_Print(); } Py_Finalize(); return 0; } -- END -- _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig