2012-02-20 36 views
5

Tôi đang cố gắng biên dịch máy chủ SSL 1.47 ASIO và các ví dụ ứng dụng khách. Tôi có thể kết hợp thành công Boost vào dự án của mình, nhưng tôi không thể kết hợp OpenSSL. Khi tôi cố gắng thêm nó tôi nhận được lỗi:Tăng SSL với Visual Studio 2010 và OpenSSL

1>SSLServer.obj : error LNK2019: unresolved external symbol _ERR_reason_error_string referenced in function "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall boost::asio::error::detail::ssl_category::message(int)const " ([email protected][email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _CRYPTO_set_id_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _CRYPTO_set_locking_callback referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _CRYPTO_num_locks referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _SSL_load_error_strings referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _SSL_library_init referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _ENGINE_cleanup referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _CONF_modules_unload referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _CRYPTO_cleanup_all_ex_data referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _EVP_cleanup referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _ERR_remove_state referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>SSLServer.obj : error LNK2019: unresolved external symbol _ERR_free_strings referenced in function "public: __thiscall boost::asio::ssl::detail::openssl_init_base::do_init::~do_init(void)" ([email protected][email protected]@[email protected]@[email protected]@[email protected]) 
1>C:\Users\Epicism\Documents\Visual Studio 2010\Projects\SSLServer\Debug\SSLServer.exe : fatal error LNK1120: 12 unresolved externals 
1> 
1>Build FAILED. 

Tôi đã thử thêm vào thư mục C: \ OpenSSL-Win32 \ lib \, C: \ OpenSSL-Win32 \ lib \ VC \, C: \ OpenSSL -Win32 \ lib \ VC \ static, C: \ OpenSSL-Win32 \ bin, C: \ OpenSSL-Win32 \ bao gồm Project-> General Properties-> Linker-> Thư viện Thư viện Bổ sung bằng cách sử dụng các thư viện được biên dịch trước openssl (http: //www.openssl.org/related/binaries.html). Tôi cũng đã cố gắng biên dịch OpenSSL bản thân mình với các lỗi tương tự. Tôi thực sự thua lỗ, tôi đã thử mọi thứ tôi đã tìm kiếm trên Google hàng nghìn lần, đã thử IRC, mọi kết hợp các thư mục mà tôi có thể nghĩ đến ...

Thiết lập của tôi là: Windows 7 64-bit Windows Visual Studio 2010 64 bit Tăng 1.47 OpenSSL 1.0.0E và G C/C++ Thư mục bao gồm bổ sung: C: \ Program Files (x86) \ boost \ boost_1_47; C: \ openssl \ include \; C: \ OpenSSL- Win32 \ lib;% (AdditionalIncludeDirectories) Project-> General Properties-> Linker-> Thư viện Thư viện Bổ sung: C: \ Program Files (x86) \ boost \ boost_1_47 \ lib; C: \ openssl \ lib; C: \ openssl; % (AdditionalLibraryDirectories) - Tôi đã thử thêm mọi thư mục vào thuộc tính này ....

Ngay bây giờ tôi chỉ cố gắng để biên dịch sau đây trong một giao diện điều khiển dự án VS C++:

// SSLServer.cpp: Xác định điểm mấu chốt cho các ứng dụng giao diện điều khiển. //

#include "stdafx.h" 
#include <cstdlib> 
#include <iostream> 
#include <boost/bind.hpp> 
#include <boost/asio.hpp> 
#include <boost/asio/ssl.hpp> 

int _tmain(int argc, _TCHAR* argv[]) 
{ 
    return 0; 
} 

Xin cảm ơn trước.

+0

CÓ tôi quá Tôi có vấn đề này như welll – jzeus

+0

Tôi cũng gặp vấn đề này. Có ai quản lý để tìm ra nó? Xin vui lòng gửi trở lại nếu bạn làm. Đã thử đề nghị của Fraser dưới đây, nhưng vẫn có vấn đề. –

Trả lời

10

Có vẻ như bạn đang sử dụng phiên bản OpenSSL 32 bit trên máy tính 64 bit.

Hãy thử tải phiên bản 64-bit (Win64 OpenSSL v1.0.0g) từ http://www.slproweb.com/products/Win32OpenSSL.html

Sau khi được cài đặt (nếu bạn sử dụng đường dẫn mặc định), bạn nên có một thư mục C:\OpenSSL-Win64.

Bạn nên thêm:

  • C:\OpenSSL-Win64\include để bổ sung của bạn Bao gồm Thư mục
  • C:\OpenSSL-Win64\lib\VC\static hoặc C:\OpenSSL-Win64\lib\VC Thư mục Thư viện bổ sung của bạn tùy thuộc vào việc bạn muốn libs tĩnh hoặc dlls tương ứng
  • libeay32<XXX>.libssleay32<XXX>.lib để Phụ thuộc bổ sung trong đó <XXX> khớp với bất kỳ cài đặt nào bạn có cho [C/C++]->[Code Generation]->[Runtime Library]
+0

Làm cách nào để bạn làm việc này với Visual Studio 2015 và Boost.Build, từ dòng lệnh (ví dụ: thông qua Jamfile?) –

3

Tôi đã quản lý để chương trình nhỏ của bạn ở trên xây dựng bằng cách liên kết với phiên bản 32 bit của thư viện Boost cùng với phiên bản OpenSSL 32 bit. Bạn cũng sẽ cần phiên bản 32 bit của redistributables. Lỗi này có trong phiên bản Boost 1.51 và 1.52, đây là các phiên bản duy nhất tôi đã thử nghiệm.

Tôi tin rằng có lỗi trong phiên bản 64 bit của thư viện ASIO. Mặc dù, có thể là một số loại vấn đề cấu hình đã ảnh hưởng đến nhiều vấn đề khác. Tôi đã gửi báo cáo lỗi Boost về vấn đề này.

0

Tôi đã gặp những vấn đề tương tự (VS2010), phương pháp giải quyết:

1) Properties-> C/C++ -> General-> bổ sung bao gồm Thư mục: yourpath \ boost_1_58_0 \ boost_1_58_0 (tôi sử dụng phiên bản 1.58.0)

2) Properties-> Linker -> General-> thêm thư mục thư viện: yourpath \ boost_1_58_0 \ boost_1_58_0 \ sân khấu \ lib

3) Properties-> Linker -> Input -> thêm Dependencies: libeay32 .lib ssleay32.lib

Hai tệp .lib này được sao chép từ thư mục cài đặt openssl.

Các vấn đề liên quan