当我尝试编译zeromq源时,我收到错误LNK2019

时间:2015-10-22 07:02:20

标签: c++ visual-studio-2013 zeromq libsodium

我正在尝试编译zeromq源代码,我有以下错误:

我正在使用Visual Studio 2013 update 4 / windows 7 x64

首先,我满意地编译了libsodium库。

然后我将libsodium头文件目录路径链接到其他依赖项,将libsodium.lib链接到其他库目录。我还在其他依赖项中指定了库的名称。

我尝试在win32架构和x64架构下编译它,但我得到了相同的错误。

我知道__imp前缀用作我想要使用的函数的桥梁,所以如果我适当地链接库,为什么会出现这个错误?

控制台日志:

1>Creating library E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.lib and object E:\zmq\libzmq\builds\msvc\vs2013\libzmq\..\..\..\..\bin\Win32\Debug\v120\dynamic\libzmq.exp
1>ctx.obj : error LNK2019: unresolved external symbol __imp__randombytes_close referenced in function "public: __thiscall zmq::ctx_t::~ctx_t(void)" (??1ctx_t@zmq@@QAE@XZ)
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__sodium_init referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t@zmq@@QAE@ABUoptions_t@1@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__sodium_init
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_keypair referenced in function "public: __thiscall zmq::curve_client_t::curve_client_t(struct zmq::options_t const &)" (??0curve_client_t@zmq@@QAE@ABUoptions_t@1@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>zmq_utils.obj : error LNK2001: unresolved external symbol __imp__crypto_box_keypair
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_beforenm referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome@curve_client_t@zmq@@AAEHPBEI@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_beforenm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box referenced in function "private: int __thiscall zmq::curve_client_t::produce_hello(class zmq::msg_t *)" (?produce_hello@curve_client_t@zmq@@AAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open referenced in function "private: int __thiscall zmq::curve_client_t::process_welcome(unsigned char const *,unsigned int)" (?process_welcome@curve_client_t@zmq@@AAEHPBEI@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::encode(class zmq::msg_t *)" (?encode@curve_client_t@zmq@@UAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__crypto_box_open_afternm referenced in function "public: virtual int __thiscall zmq::curve_client_t::decode(class zmq::msg_t *)" (?decode@curve_client_t@zmq@@UAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__crypto_box_open_afternm
1>curve_client.obj : error LNK2019: unresolved external symbol __imp__randombytes referenced in function "private: int __thiscall zmq::curve_client_t::produce_initiate(class zmq::msg_t *)" (?produce_initiate@curve_client_t@zmq@@AAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2001: unresolved external symbol __imp__randombytes
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox referenced in function "private: int __thiscall zmq::curve_server_t::produce_welcome(class zmq::msg_t *)" (?produce_welcome@curve_server_t@zmq@@AAEHPAVmsg_t@2@@Z)
1>curve_server.obj : error LNK2019: unresolved external symbol __imp__crypto_secretbox_open referenced in function "private: int __thiscall zmq::curve_server_t::process_initiate(class zmq::msg_t *)" (?process_initiate@curve_server_t@zmq@@AAEHPAVmsg_t@2@@Z)

提前致谢。

2 个答案:

答案 0 :(得分:1)

你可能会以静态的方式编写libsodium。

尝试以dinamically方式编译并再次链接。

答案 1 :(得分:0)

当您在项目中设置了错误的调用约定时,也会发生此类错误。