Boost cpp and Visual Studio 2015

Boost cpp and Visual Studio 2015

本文关键字:Studio 2015 Visual and cpp Boost      更新时间:2023-10-16

我正在尝试在Visual Studio 2015上运行cpp应用程序。此应用程序是使用 boost 1.55 使用 Visual Studio 2010 开发的,因此我使用 b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64 stage 编译了库,在链接器部分添加了 dll 文件夹,并在成瘾包含中添加了包含目录。尽管如此,我仍然收到很多错误,例如:

namespace "std" do not include member "time_t"
namespace "std" do not include member "system"

您对我如何解决这个问题有任何想法吗?

谢谢。

好吧,这看起来有点混乱。

首先,添加正确的包含:

#include <ctime>   //for std::time_t 
#include <cstdlib> // for std::system

然后,在为 msvc2015 构建 boost 时,您必须选择 msvc-14.0 工具集而不是 msvc-10.0(适用于 msvc2010)和一致的体系结构(32 或 64)。 所以你的构建命令看起来像这样:

b2 --toolset=msvc-14.0 --build-type=complete address-model=64 stage //for 64 bits