Original Post
So i've been playing with boost::python and for the most part its working great. But when i try to expose a class with a virtual function, everything falls apart. I get an "unresolved external symbol" when i use get_override(). I'm linking with boost_python_debug.lib so I can't figure out why linker can't find it. Here's the code that's breaking and the specific error i'm getting. the error message: It acts like i'm not linking the boost::python lib, but i am. What else could I be missing? Oh, and i'm trying to build this with visual studio.net 2003. somebody save my sanity
#include <string>
#include <iostream>
#include <boost/python.hpp>
using namespace boost::python;
class MyClass
{
public:
MyClass() {}
virtual ~MyClass() {}
virtual void Print() = 0;
};
struct MyClassWrapper : MyClass, wrapper<MyClass>
{
void Print()
{
this->get_override("Print")();
}
};
BOOST_PYTHON_MODULE(pythonTest)
{
class_<MyClassWrapper, boost::noncopyable>("MyClass")
.def("Print", pure_virtual(&MyClass::Print));
}
error LNK2019: unresolved external symbol "__declspec(dllimport) protected: class boost::python::override __thiscall boost::python::detail::wrapper_base::get_override(char const *,struct _typeobject *)const " (__imp_?get_override@wrapper_base@detail@python@boost@@IBE?AVoverride@34@PBDPAU_typeobject@@@Z) referenced in function "protected: class boost::python::override __thiscall boost::python::wrapper<class MyClass>::get_override(char const *)const " (?get_override@?$wrapper@VMyClass@@@python@boost@@IBE?AVoverride@23@PBD@Z)