在Windows上仅使用Boost.DateTime和错误

时间:2018-03-01 01:35:12

标签: c++ visual-studio boost

我正在使用b2.exe编译Boost.DateTime:

.\b2.exe install --with-date_time link=static runtime-link=static

它在bin.v2中创建C\:Downloads\boost_1_66_0目录,我将libboost_date_time-vc141-mt-gd-x32-1_66.lib中的静态库bin.v2\libs\date_time\build\msvc-14.1\debug\link-static\threadapi-win32\threading-multi复制到我的项目

将所有标题从C\:Downloads\boost_1_66_0\boost复制到我的项目

我尝试将#include "boost/date_time.hpp"包含错误

error(active)   E1696   cannot open source file "boost/cstdint.hpp" ConsoleApplication1 c : \Users\Administrator\source\repos\ConsoleApplication1\ConsoleApplication1\include\boost\date_time\posix_time\posix_time_config.hpp  14
Error(active)   E1696   cannot open source file "boost/config/no_tr1/cmath.hpp" ConsoleApplication1 c : \Users\Administrator\source\repos\ConsoleApplication1\ConsoleApplication1\include\boost\date_time\posix_time\posix_time_config.hpp  15
Error(active)   E1696   cannot open source file "boost/cstdint.hpp" ConsoleApplication1 c : \Users\Administrator\source\repos\ConsoleApplication1\ConsoleApplication1\include\boost\date_time\time_duration.hpp 12
Error(active)   E1696   cannot open source file "boost/operators.hpp"   ConsoleApplication1 c : \Users\Administrator\source\repos\ConsoleApplication1\ConsoleApplication1\include\boost\date_time\time_duration.hpp 13
Error(active)   E1696   cannot open source file "boost/static_assert.hpp"   ConsoleApplication1 c : \Users\Administrator\source\repos\ConsoleApplication1\ConsoleApplication1\include\boost\date_time\time_duration.hpp 14
Error(active)   E0169   expected a declaration  ConsoleApplication1 c : \Users\Administrator\source\repos\ConsoleApplication1\ConsoleApplication1\include\boost\date_time\time_duration.hpp 289
Error(active)   E1696   cannot open source file "boost/cstdint.hpp" ConsoleApplication1 c : \Users\Administrator\source\repos\ConsoleApplication1\ConsoleApplication1\include\boost\date_time\time_resolution_traits.hpp    13
Error(active)   E0020   identifier "time_resolution_traits_adapted32_impl" is undefined ConsoleApplication1 c : \Users\Administrator\source\repos\ConsoleApplication1\ConsoleApplication1\include\boost\date_time\time_resolution_traits.hpp    135
Error   LNK1104 cannot open file 'libboost_date_time-vc141-mt-sgd-x32-1_66.lib' ConsoleApplication1 C : \Users\Administrator\source\repos\ConsoleApplication1\ConsoleApplication1\LINK  1

1 个答案:

答案 0 :(得分:0)

定义#define后BOOST_DATE_TIME_NO_LIB是编译成功