0

我使用 cmake 生成 Visual Studio 项目文件并在 Visual Studio 2015 中打开项目。

我尝试使用 Visual Studio 2015 C++ 编译 libmosquitto,但出现这些错误。

我已经包含了 OpenSSL win32 的包含文件夹,但它仍然失败。

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2001 unresolved external symbol __imp___vsnprintf    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\MSVCRTD.lib(vsnprintf.obj)  1   
Error   LNK2019 unresolved external symbol __imp__vsnprintf referenced in function __mosquitto_log_printf   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\logging_mosq.obj    1   
Error   LNK2001 unresolved external symbol __imp__vsnprintf libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\MSVCRTD.lib(vsnprintf.obj)  1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\thread_mosq.obj 1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\util_mosq.obj   1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\read_handle.obj 1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\read_handle_client.obj  1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\read_handle_shared.obj  1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\socks_mosq.obj  1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\logging_mosq.obj    1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\messages_mosq.obj   1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_lock    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\thread_mosq.obj 1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\util_mosq.obj   1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\read_handle.obj 1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\read_handle_client.obj  1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\read_handle_shared.obj  1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\socks_mosq.obj  1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\logging_mosq.obj    1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\messages_mosq.obj   1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2001 unresolved external symbol __imp__pthread_mutex_unlock  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_free referenced in function __mosquitto_destroy libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2001 unresolved external symbol _SSL_CTX_free    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_pending referenced in function _mosquitto_loop  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2019 unresolved external symbol _SSL_free referenced in function __mosquitto_destroy libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2001 unresolved external symbol _SSL_free    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol __imp__pthread_equal referenced in function __mosquitto_destroy  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2019 unresolved external symbol __imp__pthread_join referenced in function __mosquitto_destroy   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2001 unresolved external symbol __imp__pthread_join  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\thread_mosq.obj 1   
Error   LNK2019 unresolved external symbol __imp__pthread_self referenced in function _mosquitto_new    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2001 unresolved external symbol __imp__pthread_self  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\thread_mosq.obj 1   
Error   LNK2019 unresolved external symbol __imp__pthread_cancel referenced in function __mosquitto_destroy libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2001 unresolved external symbol __imp__pthread_cancel    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\thread_mosq.obj 1   
Error   LNK2019 unresolved external symbol __imp__pthread_mutex_init referenced in function _mosquitto_reinitialise libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2019 unresolved external symbol __imp__pthread_mutex_destroy referenced in function __mosquitto_destroy  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\mosquitto.obj   1   
Error   LNK2019 unresolved external symbol _CRYPTO_cleanup_all_ex_data referenced in function __mosquitto_net_cleanup   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _BIO_new_socket referenced in function __mosquitto_socket_connect    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _CONF_modules_unload referenced in function __mosquitto_net_cleanup  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _ERR_get_error referenced in function __mosquitto_net_read   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _ERR_error_string referenced in function __mosquitto_net_read    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _ERR_free_strings referenced in function __mosquitto_net_cleanup libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _ERR_remove_state referenced in function __mosquitto_net_cleanup libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _OPENSSL_add_all_algorithms_noconf referenced in function __mosquitto_net_init   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _EVP_cleanup referenced in function __mosquitto_net_cleanup  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _ENGINE_cleanup referenced in function __mosquitto_net_cleanup   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_set_psk_client_callback referenced in function __mosquitto_socket_connect   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_set_cipher_list referenced in function __mosquitto_socket_connect   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_new referenced in function __mosquitto_socket_connect   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_set_bio referenced in function __mosquitto_socket_connect   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_use_PrivateKey_file referenced in function __mosquitto_socket_connect   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_use_certificate_chain_file referenced in function __mosquitto_socket_connect    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_load_error_strings referenced in function __mosquitto_net_init  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_set_verify referenced in function __mosquitto_socket_connect    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_set_default_passwd_cb referenced in function __mosquitto_socket_connect libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_set_default_passwd_cb_userdata referenced in function __mosquitto_socket_connect    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_check_private_key referenced in function __mosquitto_socket_connect libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_new referenced in function __mosquitto_socket_connect   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_connect referenced in function _mosquitto__socket_connect_tls   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_read referenced in function __mosquitto_net_read    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_write referenced in function __mosquitto_net_write  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_ctrl referenced in function __mosquitto_socket_connect  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_get_error referenced in function __mosquitto_net_read   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _TLSv1_client_method referenced in function __mosquitto_socket_connect   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _TLSv1_1_client_method referenced in function __mosquitto_socket_connect libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _TLSv1_2_client_method referenced in function __mosquitto_socket_connect libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_shutdown referenced in function __mosquitto_socket_close    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_library_init referenced in function __mosquitto_net_init    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_CTX_load_verify_locations referenced in function __mosquitto_socket_connect libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_set_ex_data referenced in function __mosquitto_socket_connect   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_get_ex_data referenced in function _psk_client_callback libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2001 unresolved external symbol _SSL_get_ex_data libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_get_ex_new_index referenced in function __mosquitto_net_init    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol _snprintf referenced in function _psk_client_callback    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\net_mosq.obj    1   
Error   LNK2019 unresolved external symbol __imp__pthread_create referenced in function _mosquitto_loop_start   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\thread_mosq.obj 1   
Error   LNK2019 unresolved external symbol _sk_num referenced in function __mosquitto_verify_certificate_hostname   libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _sk_value referenced in function __mosquitto_verify_certificate_hostname libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _sk_pop_free referenced in function __mosquitto_verify_certificate_hostname  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _ASN1_STRING_data referenced in function __mosquitto_verify_certificate_hostname libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _X509_STORE_CTX_get_ex_data referenced in function __mosquitto_server_certificate_verify libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _X509_STORE_CTX_get_error_depth referenced in function __mosquitto_server_certificate_verify libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _X509_STORE_CTX_get_current_cert referenced in function __mosquitto_server_certificate_verify    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _X509_get_subject_name referenced in function __mosquitto_verify_certificate_hostname    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _X509_NAME_get_text_by_NID referenced in function __mosquitto_verify_certificate_hostname    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _X509_get_ext_d2i referenced in function __mosquitto_verify_certificate_hostname libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _GENERAL_NAME_free referenced in function __mosquitto_verify_certificate_hostname    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _SSL_get_ex_data_X509_STORE_CTX_idx referenced in function __mosquitto_server_certificate_verify libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\tls_mosq.obj    1   
Error   LNK2019 unresolved external symbol _BN_num_bits referenced in function __mosquitto_hex2bin  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\util_mosq.obj   1   
Error   LNK2019 unresolved external symbol _BN_bn2bin referenced in function __mosquitto_hex2bin    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\util_mosq.obj   1   
Error   LNK2019 unresolved external symbol _BN_free referenced in function __mosquitto_hex2bin  libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\util_mosq.obj   1   
Error   LNK2019 unresolved external symbol _BN_hex2bn referenced in function __mosquitto_hex2bin    libmosquitto    C:\Users\KennethHu\JavaWorkspace\mosquitto2\lib\util_mosq.obj   1   
4

1 回答 1

0

我解决了大多数错误。这是因为 x86 与 x64 不兼容。我用 x86 替换 x64 libeay32MD.lib 和 ssleay32MD.lib。

于 2016-10-21T09:38:44.230 回答