如何使用CPP-NETLIB与Visual Studio 2010?(How to use cpp-

2019-10-19 16:15发布

我试图用CPP-NETLIB与Visual Studio 2010中我已经建立了CPP-NETLIB和文件添加到.LIB我的项目,但我不能编译它们。

- 环境

  • Windows 7的64位
  • CPP-NETLIB 0.11.0
  • 升压1.55.0
  • Win32的OpenSSL的v1.0.1f

我的代码是在这里。

#include <boost/network/protocol/http/client.hpp>
#include <iostream>

int main(int argc, char *argv[]) {
    using namespace boost::network;

    if (argc != 2) {
        std::cout << "Usage: " << argv[0] << " [url]" << std::endl;
        return 1;
    }

    http::client client;
    http::client::request request(argv[1]);
    request << header("Connection", "close");
    http::client::response response = client.get(request);
    std::cout << body(response) << std::endl;

    return 0;
}

我添加了CPP-NETLIB库路径和CPP-NETLIB包括路径项目。 也增加了升压和OpenSSL路径。 我加入了库到项目中。

  • libboost_system-VC100-MT-GD-1_55.lib
  • libboost_date_time-VC100-MT-GD-1_55.lib
  • libboost_regex-VC100-MT-GD-1_55.lib
  • cppnetlib-客户connections.lib
  • cppnetlib-uri.lib

我认为,来自一些有关OpenSSL的错误。

Error   55  error LNK2019: unresolved external symbol - function _BIO_ctrl ...

其实,我有一个日本人所以它就像下面。

エラー 55  error LNK2019: 未解決の外部シンボル _BIO_ctrl が関数 "public: class boost::system::error_code const & __thiscall boost::asio::ssl::detail::engine::map_error_code(class boost::system::error_code &)const " (?map_error_code@engine@detail@ssl@asio@boost@@QBEABVerror_code@system@5@AAV675@@Z) で参照されました。    cppnetlib-client-connections.lib(client.obj)    
エラー 57  error LNK2019: 未解決の外部シンボル _BIO_ctrl_pending が関数 "private: enum boost::asio::ssl::detail::engine::want __thiscall boost::asio::ssl::detail::engine::perform(int (__thiscall boost::asio::ssl::detail::engine::*)(void *,unsigned int),void *,unsigned int,class boost::system::error_code &,unsigned int *)" (?perform@engine@detail@ssl@asio@boost@@AAE?AW4want@12345@P812345@AEHPAXI@Z0IAAVerror_code@system@5@PAI@Z) で参照されました。    cppnetlib-client-connections.lib(client.obj)
エラー 43  error LNK2019: 未解決の外部シンボル _BIO_free が関数 "public: __thiscall boost::asio::ssl::detail::engine::~engine(void)" (??1engine@detail@ssl@asio@boost@@QAE@XZ) で参照されました。    cppnetlib-client-connections.lib(client.obj)    

你能告诉我,我缺少的是什么? 我想更多的库添加到项目,但它仍然没有奏效。

Answer 1:

我应得添加这两个库。

libeay32.lib ssleay32.lib



Answer 2:

我遇到了同样的问题,但我通过使用SSL的Win32版本,而不是X64版本的固定它。



文章来源: How to use cpp-netlib with Visual Studio 2010?