Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
375 views
in Technique[技术] by (71.8m points)

c++ - Building boost with Visual Studio 2013 (Express)

Has anyone successfully built Boost using Visual Studio 2013 Express?

I'm confused as to whether or not this is possible just yet as the Boost website states:

Known Bugs with Visual Studio 2013/Visual C++ 12.

Visual Studio 2013 was released quite late in the release process, so there exist several unresolved issues. These include:

Serialization can't compile because of a missing include.

Using has_member_function_callable_with from Boost.Container's allocator_traits causes a compile error (#9332).

In libraries such as Unordered and MultiIndex, calling overloaded functions with initializer lists can result in a compile error, with Visual C++ claiming that the overloads are ambiguous. This is a Visual C++ bug and it isn't clear if there's a good workaround. This won't affect code that doesn't use initializer lists, or uses an initializer list that doesn't require an implicit conversion (i.e. an initializer list of the container's exact value type).

Thread: ex_scoped_thread compile fails (#9333).

However, this poster says it is possible to build Boost 1.55.0 using VS 2013 without any patches.

I have tried to build Boost using VS 2013 and I do indeed get at least the Serialization error.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I've recently built Boost on MSVC12 (VS2013) using only a minor patch:

Subject: [PATCH] Fixing boost serialization build on MSVC2013

include fix (manual)
config_decltype_n3276_new.patch (from https://svn.boost.org/trac/boost/ticket/9410)

As you can see it combines the patch from https://svn.boost.org/trac/boost/ticket/9410 with some manual include fixes (they were trivial).

This is the effective patch:

diff --git a/3rdparty/boost_1_55_0/boost/archive/iterators/transform_width.hpp b/3rdparty/boost_1_55_0/boost/archive/iterators/transform_width.hpp
index 5a5c7b7..8da85ee 100644
--- a/3rdparty/boost_1_55_0/boost/archive/iterators/transform_width.hpp
+++ b/3rdparty/boost_1_55_0/boost/archive/iterators/transform_width.hpp
@@ -29,6 +29,7 @@

#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/iterator/iterator_traits.hpp>
+#include <algorithm>

namespace boost { 
namespace archive {
diff --git a/3rdparty/boost_1_55_0/boost/config/compiler/visualc.hpp b/3rdparty/boost_1_55_0/boost/config/compiler/visualc.hpp
index 695fa94..1c0f4f0 100644
--- a/3rdparty/boost_1_55_0/boost/config/compiler/visualc.hpp
+++ b/3rdparty/boost_1_55_0/boost/config/compiler/visualc.hpp
@@ -180,13 +180,13 @@
#  define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
#  define BOOST_NO_CXX11_VARIADIC_TEMPLATES
#  define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
+#  define BOOST_NO_CXX11_DECLTYPE_N3276
#endif

// C++11 features not supported by any versions
#define BOOST_NO_CXX11_CHAR16_T
#define BOOST_NO_CXX11_CHAR32_T
#define BOOST_NO_CXX11_CONSTEXPR
-#define BOOST_NO_CXX11_DECLTYPE_N3276
#define BOOST_NO_CXX11_NOEXCEPT
#define BOOST_NO_CXX11_UNICODE_LITERALS
#define BOOST_NO_SFINAE_EXPR
diff --git a/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_fail.cpp b/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_fail.cpp
index 216300c..1c0e6c7 100644
--- a/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_fail.cpp
+++ b/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_fail.cpp
@@ -32,6 +32,6 @@

int main( int, char *[] )
{
-   return boost_no_decltype_n3276::test();
+   return boost_no_cxx11_decltype_n3276::test();
}

diff --git a/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_pass.cpp b/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_pass.cpp
index 35427be..86e3664 100644
--- a/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_pass.cpp
+++ b/3rdparty/boost_1_55_0/libs/config/test/no_decltype_n3276_pass.cpp
@@ -27,11 +27,11 @@
#ifndef BOOST_NO_CXX11_DECLTYPE_N3276
#include "boost_no_decltype_n3276.ipp"
#else
-namespace boost_no_decltype_n3276 = empty_boost;
+namespace boost_no_cxx11_decltype_n3276 = empty_boost;
#endif

int main( int, char *[] )
{
-   return boost_no_decltype_n3276::test();
+   return boost_no_cxx11_decltype_n3276::test();
}

Serialization works nicely even with the EPA Portable Archive implementation

Disclaimer This is with 'regular' Visual Studio. It will probably work with VS Express. (if you have the Windows SDK)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...