Skip to content

cpp-netlib 0.12.0 build error with visual studio 2015 and boost 1.60 #648

Closed

Description

@zengxs

I'm sorry for my English.

my environment:

  • windows 10 th2 10586.218 x64
  • visual studio community 2015 update2
  • boost 1.60
  • cpp-netlib-0.12.0-final

I build boost with this command in x86 native mode:

b2 install --prefix=C:\Users\Samuel\Desktop\builds\target --toolset=msvc --without-python link=static runtime-link=shared debug release

and I generate cpp-netlib.sln with this cmake command:

mkdir cpn-build
cd cpn-build
cmake ..\cpp-netlib-0.12.0-final -G "Visual Studio 14" -DBOOST_ROOT=C:\Users\Samuel\Desktop\builds\target

and then, I tried to build cpp-netlib in visual studio.
But, in build project cppnetlib-server-parsers, vs2015 tips:

C:\Users\Samuel\Desktop\builds\target\include\boost-1_60\boost/type_traits/is_const.hpp(37): error C2872: “true_type”: ambiguous symbol

and build failed eventually.

Am I build it in wrong way? How can I build it correctly?

Activity

  1. snap9 commented on May 6, 2016

    @snap9

    I'm having exactly this problem.

    Anyone found a solution yet?

  2. ytong3 commented on May 6, 2016

    @ytong3

    If you can live without 0.12, you may want to try 0.11.

    Sent using Email (https://itunes.apple.com/app/apple-store/id922793622?pt=814382&ct=Email&mt=8)

    On May 6, 2016 at 2:51 PM, <snap9 (mailto:notifications@github.com)> wrote:

    I'm having exactly this problem.

    Anyone found a solution yet?

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly or view it on GitHub (#648 (comment))

  3. deanberris commented on May 10, 2016

    @deanberris
    Member

    I don't have a solution yet because I don't have access to MSVC 2015 -- and I don't know where exactly to start here. Any tips for debugging this would be really helpful.

  4. snap9 commented on May 12, 2016

    @snap9

    @deanberris I downloaded VS2015 for free on Microsoft's page. It's right here: https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx (I clicked on Download under "Express for Desktop").

  5. burannah commented on May 19, 2016

    @burannah

    As a fast & dirty workaround you can change that true_type@ is_const.hpp:37 to std::true_type to avoid ambiguous declaration.
    It's (almost) the same type.

  6. snap9 commented on May 21, 2016

    @snap9

    @burannah That quick and dirty workaround seems to work. Thanks! @deanberris Maybe you guys can add the change in the official cpp-netlib? (See my above comment about getting VS2015 for free.)

  7. modified the milestone: 0.13 on Jun 14, 2016
  8. enricodetoma commented on Sep 27, 2016

    @enricodetoma

    @burannah @snap9 but is_const.hpp:37 is in Boost, not in cpp-netlib! It can't be a valid fix...

  9. enricodetoma commented on Sep 27, 2016

    @enricodetoma

    I have create pull request #685 to solve the compilation problem with Visual Studio 2015

  10. added a commit that references this issue on Oct 5, 2016
  11. enricodetoma commented on Oct 13, 2016

    @enricodetoma

    I can confirm that this issue can be closed for milestone 0.13 too.

  12. mjfryc commented on Nov 30, 2016

    @mjfryc

    It was needed to compile cppnetlib-server-parsers.

    Solution: in my case I had to modify:
    [cpp-netlib-0.11.2_dir]\boost\network\protocol\http\server\impl\parsers.ipp
    by:

    • Extract function BOOST_NETWORK_INLINE void parse_version to anonymous namespace and rename it e.g. to parse_version_hack.
    • In "Original" parse_version function do NOT use using namespace boost::spirit::qi; and delegate this function to anonymous namespace function.

    Below example (sorry for identation lack):
    `namespace
    {
    BOOST_NETWORK_INLINE void parse_headers_hack(
    std::string const& input, std::vectorboost::network::http::request_header_narrow& container) {
    using namespace boost::spirit::qi;
    boost::u8_to_u32_iteratorstd::string::const_iterator begin = input.begin(), end = input.end();
    typedef boost::spirit::qi::asboost::spirit::traits::u32_string as_u32_string;
    parse(begin, end,
    *(+((alnum | punct) - ':') >> lit(": ") >>
    as_u32_string()[+((unicode::alnum | space | punct) - '\r' - '\n')] >>
    lit("\r\n")) >>
    lit("\r\n"),
    container);
    }
    }

    namespace boost {
    namespace network {
    namespace http {

    BOOST_NETWORK_INLINE void parse_version(
    std::string const& partial_parsed, boost::fusion::tuple<boost::uint8_t, boost::uint8_t>& version_pair)
    {
    boost::spirit::qi::parse
    (
    partial_parsed.begin(),
    partial_parsed.end(),
    (
    boost::spirit::qi::lit("HTTP/") >> boost::spirit::qi::ushort_ >> '.' >> boost::spirit::qi::ushort_
    ),
    version_pair
    );
    }`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions