[C++-sig] Unresolved external symbols with Visual C++ 7.0 and 7.1

Patrick Hartling patrick at vrac.iastate.edu
Sat Aug 30 04:37:18 CEST 2003


I am having a really hard time trying to get my Boost.Python-based 
module to compile on Windows using Visual C++ 7.0 or 7.1.  Everything is 
fine with GCC and MIPSpro, but with Visual C++, I get linker errors 
about three missing symbols.  I have attached a file that demonstrates 
the linker error, but it only shows one of the unresolved symbols:

test.obj : error LNK2019: unresolved external symbol 
"__declspec(dllimport) class boost::python::api::object __cdecl 
boost::python::objects::function_object(class boost::function2<struct 
_object *,struct _object *,struct _object *,class std::allocator<class 
boost::function_base> > const &,unsigned int,struct std::pair<struct 
boost::python::detail::keyword const *,struct 
boost::python::detail::keyword const *> const &)" 
(__imp_?function_object at objects@python at boost@@YA?AVobject at api@23 at ABV?$function2 at PAU_object@@PAU1 at PAU1@V?$allocator at Vfunction_base@boost@@@std@@@3 at IABU?$pair at PBUkeyword@detail at python@boost@@PBU1234@@std@@@Z) 
referenced in function "class boost::python::api::object __cdecl 
boost::python::detail::make_function_aux<void (__cdecl*)(struct _object 
*),struct boost::python::default_call_policies,struct 
boost::python::detail::args_from_python,struct 
boost::mpl::list2<void,struct _object *>,struct boost::mpl::int_<0> 
 >(void (__cdecl*)(struct _object *),struct 
boost::python::default_call_policies const &,struct 
boost::python::detail::args_from_python const &,struct 
boost::mpl::list2<void,struct _object *> const &,struct std::pair<struct 
boost::python::detail::keyword const *,struct 
boost::python::detail::keyword const *> const &,struct 
boost::mpl::int_<0>)" 
(??$make_function_aux at P6AXPAU_object@@@ZUdefault_call_policies at python@boost@@Uargs_from_python at detail@34 at U?$list2 at XPAU_object@@@mpl at 4@U?$int_@$0A@@84@@detail at python@boost@@YA?AVobject at api@12 at P6AXPAU_object@@@ZABUdefault_call_policies at 12@ABUargs_from_python at 012@ABU?$list2 at XPAU_object@@@mpl at 2@ABU?$pair at PBUkeyword@detail at python@boost@@PBU1234@@std@@U?$int_@$0A@@92@@Z)

If I defined and expose methods from the class to Python, I could get 
the number of unresolved symbols goes up to three.  However, I suspect 
that if I can figure out what is going wrong that causes the above 
error, I will be able to fix the other two unresolved symbols as well.

I based my compiler and linker commands on the output from running jam 
with the -n option, as suggested by the documentation:

cl /nologo /TP /Zm800 /GR /GX /Z7 /Od /Ob0 /GX /GR /MDd 
/IC:\cygwin\home\patrick\bpl-vc71\include /IC:\Python22\include /I. /c 
test.cpp

link /nologo/DEBUG /subsystem:console /incremental:no /dll /out:test.pyd 
/implib:test.lib /LIBPATH:C:\cygwin\home\patrick\bpl-vc71\lib 
/LIBPATH:C\Python22\libs boost_python.lib test.obj

What I am missing or doing wrong?

  -Patrick


-- 
Patrick L. Hartling                     | Research Assistant, VRAC
patrick at vrac.iastate.edu                | 2624 Howe Hall: 1.515.294.4916
http://www.137.org/patrick/             | http://www.vrac.iastate.edu/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.cpp
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030829/21f786eb/attachment.txt>


More information about the Cplusplus-sig mailing list