I am trying to wrap some C++ functions for use in python. For example here is the function from the boost Python tutorial.
// Copyright Joel de Guzman 2002-2004. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
// Hello World Example from the tutorial
// [Joel de Guzman 10/9/2002]
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
char const* greet()
{
return "hello, world";
}
BOOST_PYTHON_MODULE(hello_ext)
{
using namespace boost::python;
def("greet", greet);
}
When I compile this into a .pyc file and try to import it into python I receive the error:
ImportError: Bad magic number in C:\hello_ext.pyc
I have checked the magic number using a method from another forum and it does seem to be wrong. I googled around and I haven't been able to find any useful information regarding this error message. I suspect this is a bad setting in my visual studio project file, or maybe something with the way I compiled boost?
I am using visual studio 2010 service pack 1, python 2.7.3 and boost 1.53
I compiled boost with the following options.
b2 install toolset=msvc-10.0 variant=debug,release threading=multi link=shared runtime-link=shared --prefix="C:\boost"