|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-10-18 07:33:30
IIRC we've seen this problem before and it's a known VC6 bug without a known
workaround... Sorry!
===================================================
David Abrahams, C++ library designer for hire
resume: http://users.rcn.com/abrahams/resume.html
C++ Booster (http://www.boost.org)
email: david.abrahams_at_[hidden]
===================================================
----- Original Message -----
From: <Drew.Whitehouse_at_[hidden]>
>
> 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.....
> file://hello_class.def(&hello::greet, "greet");
> }
> catch(...)
> {
> python::handle_exception(); // Deal with the exception for Python
> }
> }
>
>
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk