我正在学习升级库,以便将来在Windows上的x64控制台应用程序中使用。我尝试了这里提供的最简单的例子:
我希望构建的boost库满足以下条件:
我阅读了该网页上的说明并搜索了许多其他页面并尝试了许多构建命令,例如:
bjam --build-type=complete toolset=msvc-10.0 threading=multi link=static address-model=64
b2 variant=release --build-type=complete architecture=x86 address-model=64 stage
b2 runtime-link=static variant=release address-model=64
最后,我在x64 | Debug模式下成功构建了一个小型visual studio项目。但是,当我尝试发布模式时,我得到的错误如下:
1>libboost_regex-vc120-mt-sgd-1_59.lib(instances.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(instances.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(regex.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(regex.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(regex_traits_defaults.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(regex_traits_defaults.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(static_mutex.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(static_mutex.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(w32_regex_traits.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(w32_regex_traits.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(regex_raw_buffer.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in Temp.obj
1>libboost_regex-vc120-mt-sgd-1_59.lib(regex_raw_buffer.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in Temp.obj
1>libcpmtd.lib(stdthrow.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in Temp.obj
1>libcpmtd.lib(stdthrow.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MT_StaticRelease' in Temp.obj
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
我正在使用Visual Studio 2013.似乎" sgd" in" libboost_regex-vc120-mt-sgd-1_59.lib(regex.obj)"表示它是一个调试库。我搜索了%BOOST_ROOT%\ stage \ lib。与libboost_regex一样,我有:
"C:\Program Files\boost\boost_1_59_0\stage\lib\libboost_regex-vc120-s-1_59.lib"
"C:\Program Files\boost\boost_1_59_0\stage\lib\libboost_regex-vc120-sgd-1_59.lib"
"C:\Program Files\boost\boost_1_59_0\stage\lib\libboost_regex-vc120-mt-1_59.lib"
"C:\Program Files\boost\boost_1_59_0\stage\lib\libboost_regex-vc120-mt-s-1_59.lib"
"C:\Program Files\boost\boost_1_59_0\stage\lib\libboost_regex-vc120-mt-sgd-1_59.lib"
"C:\Program Files\boost\boost_1_59_0\stage\lib\libboost_regex-vc120-mt-gd-1_59.lib"
我没有为visual studio指定libboost_regex-vc120-mt-sgd-1_59.lib,它是由visual studio自动选择的。所以,我想我要么没有构建真正需要的lib,要么我需要以某种方式设置项目属性。
答案 0 :(得分:-1)
您不希望将发布版本与LIBCMTD链接起来。