← 输入框|github.com|刷新
Skip to content

Client compilation failure when including boost/network/protocol/http/server.hpp #13

Closed

Description

@glynos

The following code fails to compile on MSVC 8.0:

#include "boost/network/protocol/http/client.hpp"
#include "boost/network/protocol/http/server.hpp"
int
main(int argc, char *argv[]) {
    typedef
        boost::network::http::basic_client<boost::network::tags::http_keepalive_8bit_udp_resolve, 1, 1> http_client;
    http_client client;
    return 0;
}

This fails with the following compilation error:

..\..\..\boost/network/protocol/http/policies/sync_resolver.hpp(25) : error C2059: syntax error : '<'
        ..\..\..\boost/network/protocol/http/policies/pooled_connection.hpp(25) : see reference to class template instantiation 'boost::network::http::policies::sync_resolver<Tag>' being compiled
        with
        [
            Tag=boost::network::tags::http_keepalive_8bit_udp_resolve
        ]
        ..\..\..\boost/network/protocol/http/client.hpp(29) : see reference to class template instantiation 'boost::network::http::pooled_connection_policy<Tag,version_major,version_minor>' being compiled
        with
        [
            Tag=boost::network::tags::http_keepalive_8bit_udp_resolve,
            version_major=1,
            version_minor=1
        ]
        erik_test.cpp(16) : see reference to class template instantiation 'boost::network::http::basic_client<Tag,version_major,version_minor>' being compiled
        with
        [
            Tag=boost::network::tags::http_keepalive_8bit_udp_resolve,
            version_major=1,
            version_minor=1
        ]
..\..\..\boost/network/protocol/http/policies/sync_resolver.hpp(25) : error C2039: 'type' : is not a member of '`global namespace''
..\..\..\boost/network/protocol/http/policies/sync_resolver.hpp(25) : error C2238: unexpected token(s) preceding ';'
..\..\..\boost/network/protocol/http/policies/sync_resolver.hpp(26) : error C2065: 'string_type' : undeclared identifier
..\..\..\boost/network/protocol/http/policies/sync_resolver.hpp(32) : error C2061: syntax error : identifier 'string_type'

Activity

  1. nelson2005 commented on Mar 15, 2010

    @nelson2005

    this might be caused by the using directives in server.hpp.

      using boost::shared_ptr;
      using std::string;
      using boost::asio::ip::tcp;
      using boost::bind;
    

    I think it's probably better style to forgo the use of using directives at namespace scope in header files.

    I get a very similar error if I compile just this in a cpp file

    #include "boost/network/protocol/http/server.hpp"

    #include "boost/network/protocol/http/client.hpp"

  2. glynos commented on Mar 17, 2010

    @glynos
    MemberAuthor

    Hmm yeah, the using std::string directive clashes directly with the boost::network::string trait. Thanks for finding this, I will make some changes to these files and commit them as soon as I can.

  3. glynos commented on Mar 21, 2010

    @glynos
    MemberAuthor

    This has been merged into the 0.6-devel integration branch.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions