Build 如何使zeromq/cppzmq的API草稿能够在带有vcpkg的Windows上构建?

Build 如何使zeromq/cppzmq的API草稿能够在带有vcpkg的Windows上构建?,build,zeromq,failed-installation,vcpkg,Build,Zeromq,Failed Installation,Vcpkg,对于vcpkg,在我为zeromq和cppzmq启用ZMQ\u BUILD\u DRAFT\u API之后。生成失败,出现以下错误 1>------ Build started: Project: myproj, Configuration: Debug x64 ------ 1>my1.cpp 1>my2.cpp 1>my3.cpp 1>my4.cpp 1>my5.obj : error LNK2019: unresolved external symbol

对于vcpkg,在我为
zeromq
cppzmq
启用
ZMQ\u BUILD\u DRAFT\u API
之后。生成失败,出现以下错误

1>------ Build started: Project: myproj, Configuration: Debug x64 ------
1>my1.cpp
1>my2.cpp
1>my3.cpp
1>my4.cpp
1>my5.obj : error LNK2019: unresolved external symbol __imp_zmq_poller_new referenced in function "public: __cdecl zmq::poller_t<unsigned __int64>::poller_t<unsigned __int64>(void)" (??0?$poller_t@_K@zmq@@QEAA@XZ)
1>my5.obj : error LNK2019: unresolved external symbol __imp_zmq_poller_destroy referenced in function "public: void __cdecl zmq::poller_t<unsigned __int64>::destroy_poller_t::operator()(void *)" (??Rdestroy_poller_t@?$poller_t@_K@zmq@@QEAAXPEAX@Z)
1>my5.obj : error LNK2019: unresolved external symbol __imp_zmq_poller_add referenced in function "private: void __cdecl zmq::poller_t<unsigned __int64>::add_impl(class zmq::socket_ref,enum zmq::event_flags,unsigned __int64 *)" (?add_impl@?$poller_t@_K@zmq@@AEAAXVsocket_ref@2@W4event_flags@2@PEA_K@Z)
1>my5.obj : error LNK2019: unresolved external symbol __imp_zmq_poller_remove referenced in function "public: void __cdecl zmq::poller_t<unsigned __int64>::remove(class zmq::socket_ref)" (?remove@?$poller_t@_K@zmq@@QEAAXVsocket_ref@2@@Z)
1>my5.obj : error LNK2019: unresolved external symbol __imp_zmq_poller_wait_all referenced in function "public: unsigned __int64 __cdecl zmq::poller_t<unsigned __int64>::wait_all(class std::vector<struct zmq::poller_event<unsigned __int64>,class std::allocator<struct zmq::poller_event<unsigned __int64> > > &,class std::chrono::duration<__int64,struct std::ratio<1,1000> >)" (?wait_all@?$poller_t@_K@zmq@@QEAA_KAEAV?$vector@U?$poller_event@_K@zmq@@V?$allocator@U?$poller_event@_K@zmq@@@std@@@std@@V?$duration@_JU?$ratio@$00$0DOI@@std@@@chrono@4@@Z)
1>G:\build\x64\Debug\myproj.exe : fatal error LNK1120: 5 unresolved externals
1>Done building project "myproj.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


这是cppzmq的一个

include(vcpkg_common_functions)

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO zeromq/cppzmq
    REF v4.4.1
    SHA512 5178a24413e44a6d99e57db7c9859c72279304272baa0e1fb810174cdf592cb567cab98428ef3ab611042bdf4bc506867421662409d1f0d82c233cb83ebdb801
    HEAD_REF master
)

vcpkg_configure_cmake(
    SOURCE_PATH ${SOURCE_PATH}
    PREFER_NINJA
    OPTIONS 
        -DCPPZMQ_BUILD_TESTS=OFF
        -DZMQ_BUILD_DRAFT_API=ON
)



vcpkg_install_cmake()

vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/cppzmq)

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/share/cppzmq/libzmq-pkg-config)

# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cppzmq)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/cppzmq/LICENSE ${CURRENT_PACKAGES_DIR}/share/cppzmq/copyright)

导出符号的DUMPBIN输出显示缺少相关符号

Microsoft (R) COFF/PE Dumper Version 14.16.27032.1
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file E:\_dev\vcpkg\installed\x64-windows\lib\libzmq-mt-4_3_3.lib

File Type: LIBRARY

COFF SYMBOL TABLE
000 01016998 ABS    notype       Static       | @comp.id
001 00000000 SECT2  notype       External     | __IMPORT_DESCRIPTOR_libzmq-mt-4_3_3
002 C0000040 SECT2  notype       Section      | .idata$2
003 00000000 SECT3  notype       Static       | .idata$6
004 C0000040 UNDEF  notype       Section      | .idata$4
005 C0000040 UNDEF  notype       Section      | .idata$5
006 00000000 UNDEF  notype       External     | __NULL_IMPORT_DESCRIPTOR
007 00000000 UNDEF  notype       External     | libzmq-mt-4_3_3_NULL_THUNK_DATA

String Table Size = 0x62 bytes

COFF SYMBOL TABLE
000 01016998 ABS    notype       Static       | @comp.id
001 00000000 SECT2  notype       External     | __NULL_IMPORT_DESCRIPTOR

String Table Size = 0x1D bytes

COFF SYMBOL TABLE
000 01016998 ABS    notype       Static       | @comp.id
001 00000000 SECT2  notype       External     | libzmq-mt-4_3_3_NULL_THUNK_DATA

String Table Size = 0x25 bytes

     Exports

       ordinal    name

                  zmq_atomic_counter_dec
                  zmq_atomic_counter_destroy
                  zmq_atomic_counter_inc
                  zmq_atomic_counter_new
                  zmq_atomic_counter_set
                  zmq_atomic_counter_value
                  zmq_bind
                  zmq_close
                  zmq_connect
                  zmq_ctx_destroy
                  zmq_ctx_get
                  zmq_ctx_new
                  zmq_ctx_set
                  zmq_ctx_shutdown
                  zmq_ctx_term
                  zmq_curve_keypair
                  zmq_curve_public
                  zmq_device
                  zmq_disconnect
                  zmq_errno
                  zmq_getsockopt
                  zmq_has
                  zmq_init
                  zmq_msg_close
                  zmq_msg_copy
                  zmq_msg_data
                  zmq_msg_get
                  zmq_msg_gets
                  zmq_msg_init
                  zmq_msg_init_data
                  zmq_msg_init_size
                  zmq_msg_more
                  zmq_msg_move
                  zmq_msg_recv
                  zmq_msg_send
                  zmq_msg_set
                  zmq_msg_size
                  zmq_poll
                  zmq_proxy
                  zmq_proxy_steerable
                  zmq_recv
                  zmq_recviov
                  zmq_recvmsg
                  zmq_send
                  zmq_send_const
                  zmq_sendiov
                  zmq_sendmsg
                  zmq_setsockopt
                  zmq_sleep
                  zmq_socket
                  zmq_socket_monitor
                  zmq_stopwatch_intermediate
                  zmq_stopwatch_start
                  zmq_stopwatch_stop
                  zmq_strerror
                  zmq_term
                  zmq_threadclose
                  zmq_threadstart
                  zmq_timers_add
                  zmq_timers_cancel
                  zmq_timers_destroy
                  zmq_timers_execute
                  zmq_timers_new
                  zmq_timers_reset
                  zmq_timers_set_interval
                  zmq_timers_timeout
                  zmq_unbind
                  zmq_version
                  zmq_z85_decode
                  zmq_z85_encode

  Summary

          DB .debug$S
          14 .idata$2
          14 .idata$3
           8 .idata$4
           8 .idata$5
          14 .idata$6

如何使用vcpkg启用API草案?

解决方法: 我用错了开关

此处必须是
-DENABLE\u DRAFTS=ON
ZMQ\u BUILD\u DRAFT\u API
是 预处理器定义,但CMake选项称为
启用\u草稿

除此之外,预处理器
ZMQ\u BUILD\u DRAFT\u API
仍必须在VS项目中定义

我希望这样的信息能更容易查找

Microsoft (R) COFF/PE Dumper Version 14.16.27032.1
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file E:\_dev\vcpkg\installed\x64-windows\lib\libzmq-mt-4_3_3.lib

File Type: LIBRARY

COFF SYMBOL TABLE
000 01016998 ABS    notype       Static       | @comp.id
001 00000000 SECT2  notype       External     | __IMPORT_DESCRIPTOR_libzmq-mt-4_3_3
002 C0000040 SECT2  notype       Section      | .idata$2
003 00000000 SECT3  notype       Static       | .idata$6
004 C0000040 UNDEF  notype       Section      | .idata$4
005 C0000040 UNDEF  notype       Section      | .idata$5
006 00000000 UNDEF  notype       External     | __NULL_IMPORT_DESCRIPTOR
007 00000000 UNDEF  notype       External     | libzmq-mt-4_3_3_NULL_THUNK_DATA

String Table Size = 0x62 bytes

COFF SYMBOL TABLE
000 01016998 ABS    notype       Static       | @comp.id
001 00000000 SECT2  notype       External     | __NULL_IMPORT_DESCRIPTOR

String Table Size = 0x1D bytes

COFF SYMBOL TABLE
000 01016998 ABS    notype       Static       | @comp.id
001 00000000 SECT2  notype       External     | libzmq-mt-4_3_3_NULL_THUNK_DATA

String Table Size = 0x25 bytes

     Exports

       ordinal    name

                  zmq_atomic_counter_dec
                  zmq_atomic_counter_destroy
                  zmq_atomic_counter_inc
                  zmq_atomic_counter_new
                  zmq_atomic_counter_set
                  zmq_atomic_counter_value
                  zmq_bind
                  zmq_close
                  zmq_connect
                  zmq_ctx_destroy
                  zmq_ctx_get
                  zmq_ctx_new
                  zmq_ctx_set
                  zmq_ctx_shutdown
                  zmq_ctx_term
                  zmq_curve_keypair
                  zmq_curve_public
                  zmq_device
                  zmq_disconnect
                  zmq_errno
                  zmq_getsockopt
                  zmq_has
                  zmq_init
                  zmq_msg_close
                  zmq_msg_copy
                  zmq_msg_data
                  zmq_msg_get
                  zmq_msg_gets
                  zmq_msg_init
                  zmq_msg_init_data
                  zmq_msg_init_size
                  zmq_msg_more
                  zmq_msg_move
                  zmq_msg_recv
                  zmq_msg_send
                  zmq_msg_set
                  zmq_msg_size
                  zmq_poll
                  zmq_proxy
                  zmq_proxy_steerable
                  zmq_recv
                  zmq_recviov
                  zmq_recvmsg
                  zmq_send
                  zmq_send_const
                  zmq_sendiov
                  zmq_sendmsg
                  zmq_setsockopt
                  zmq_sleep
                  zmq_socket
                  zmq_socket_monitor
                  zmq_stopwatch_intermediate
                  zmq_stopwatch_start
                  zmq_stopwatch_stop
                  zmq_strerror
                  zmq_term
                  zmq_threadclose
                  zmq_threadstart
                  zmq_timers_add
                  zmq_timers_cancel
                  zmq_timers_destroy
                  zmq_timers_execute
                  zmq_timers_new
                  zmq_timers_reset
                  zmq_timers_set_interval
                  zmq_timers_timeout
                  zmq_unbind
                  zmq_version
                  zmq_z85_decode
                  zmq_z85_encode

  Summary

          DB .debug$S
          14 .idata$2
          14 .idata$3
           8 .idata$4
           8 .idata$5
          14 .idata$6