Link failures building TagPy on Windows
I'm a hapless Linux coder trying to get one of my projects working in Windows 7, which involves building TagPy. I'm using MSVC2008 and Python 2.7.1 (x86 version).
I have successfully installed CMake and built TagLib, and installed the Boost headers and Boost.Python binary from the BoostPro installer. I have set the boost and taglib lib dirs, include dirs and lib names, plus the boost compiler, in configure.py.
My %path%, %lib% and %libpath% have the directories for MSVC etc added, as set by the batch script provided by VC.
I get the following errors on link:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo
/INCREMENTAL:NO "/LIBPATH:C:/Program Files (x86)/taglib/lib" "/LIBPATH:C:\Progra
m Files (x86)\boost\boost_1_46_1\lib" /LIBPATH:C:\Python27\libs /LIBPATH:C:\Pyth
on27\PCbuild tagd.lib boost_python-vc90-mt-1_46_1.lib /EXPORT:init_tagpy build\t
emp.win32-2.7\Release\src/wrapper/basics.obj build\temp.win32-2.7\Release\src/wr
apper/id3.obj build\temp.win32-2.7\Release\src/wrapper/rest.obj /OUT:build\lib.w
in32-2.7\_tagpy.pyd /IMPLIB:build\temp.win32-2.7\Release\src/wrapper\_tagpy.lib
/MANIFESTFILE:build\temp.win32-2.7\Release\src/wrapper\_tagpy.pyd.manifest
Creating library build\temp.win32-2.7\Release\src/wrapper\_tagpy.lib and obje
ct build\temp.win32-2.7\Release\src/wrapper\_tagpy.exp
basics.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu
blic: __thiscall TagLib::String::String(class std::basic_string<wchar_t,struct s
td::char_traits<wchar_t>,class s开发者_运维技巧td::allocator<wchar_t> > const &,enum TagLib::St
ring::Type)" (__imp_??0String@TagLib@@QAE@ABV?$basic_string@_WU?$char_traits@_W@
std@@V?$allocator@_W@2@@std@@W4Type@01@@Z) referenced in function "public: stati
c void __cdecl boost::python::converter::implicit<class std::basic_string<wchar_
t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,class TagLib:
:String>::construct(struct _object *,struct boost::python::converter::rvalue_fro
m_python_stage1_data *)" (?construct@?$implicit@V?$basic_string@_WU?$char_traits
@_W@std@@V?$allocator@_W@2@@std@@VString@TagLib@@@converter@python@boost@@SAXPAU
_object@@PAUrvalue_from_python_stage1_data@234@@Z)
build\lib.win32-2.7\_tagpy.pyd : fatal error LNK1120: 1 unresolved externals
What am I missing?
(Note: I previously had Boost-related exceptions in the unresolved externals as well, but passing /EHsc as a compiler flag fixed that.)
See this answer, I think it's the same problem. The /Zc:wchar_t-
flag will go away with the next TagLib release, but for now it's enabled in the default CMakeLists.txt
file.
精彩评论