|
Boost : |
From: Drew.Whitehouse_at_[hidden]
Date: 2001-10-18 00:49:58
Under VC6 I have a strange linking problem - if the specified line is
uncommented things work, otherwise I see the error -
Creating library Debug/_alchemy_d.lib and object
Debug/_alchemy_d.exp
_alchemy.obj : error LNK2001: unresolved external symbol "class
`anonymous namespace'::hello & __cdecl from_python(struct _object
*,struct boost::python::type<class `anonymous namespace'::hello &>)"
(?from_python@@YAAAVhello@?%D:\home\drw900\Project
s\pyAlchemy\SRC\boostAlchemy\_alchemy.cpp204027573@@PAU_object@@U?
$type_at_AAVhello@?%D:\home\drw900
\Projects\pyAlchemy\SRC\boostAlchemy\_alchemy.cpp204027573@@@python_at_bo
ost@@@Z)
_alchemy_d.pyd : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
_alchemy_d.pyd - 2 error(s), 0 warning(s)
The code is -
#include <iostream>
#include <string>
namespace
{
class hello
{
public:
hello() { this->country = "none"; }
void foo() const { std::cerr << "Hello from " + country; }
std::string greet() const { return "Hello from " + country; }
private:
std::string country;
};
}
#include <boost/python/class_builder.hpp>
namespace python = boost::python;
BOOST_PYTHON_MODULE_INIT(_alchemy)
{
try
{
python::module_builder this_module("_alchemy");
python::class_builder<hello> hello_class(this_module, "hello");
hello_class.def(python::constructor<>());
hello_class.def(&hello::foo, "foo");
// module links if the next line uncommented.....
//hello_class.def(&hello::greet, "greet");
}
catch(...)
{
python::handle_exception(); // Deal with the exception for Python
}
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk