-
Notifications
You must be signed in to change notification settings - Fork 174
Open
Description
environment: win 10 + clion + vcpkg + VS 2022 toolchain
opendht version: v3.2.0
Cmakelists.txt files in the source code are almost unavailable. Combining the current compilation environment rewriting CMAKELISTS.txt file,
...
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(OPENDHT_HTTP ON)
set(OPENDHT_TOOLS OFF)
set(OPENDHT_PROXY_CLIENT ON)
list(APPEND opendht_SOURCES src/base64.h src/base64.cpp)
find_package(PkgConfig REQUIRED)
pkg_search_module(GnuTLS REQUIRED IMPORTED_TARGET gnutls)
pkg_search_module(Nettle REQUIRED IMPORTED_TARGET nettle)
pkg_search_module(OPENSSL REQUIRED IMPORTED_TARGET openssl)
pkg_search_module(argon2 REQUIRED IMPORTED_TARGET libargon2)
find_package(fmt CONFIG REQUIRED)
find_package(msgpack-cxx CONFIG REQUIRED)
find_package(Restinio CONFIG REQUIRED)
find_package(jsoncpp CONFIG REQUIRED)
find_package(unofficial-readline-win32 CONFIG REQUIRED)
add_definitions(-DOPENDHT_JSONCPP)
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN -DSTATIC_GETOPT -DGNUTLS_INTERNAL_BUILD)
set(DISABLE_MSC_WARNINGS "/wd4101 /wd4244 /wd4267 /wd4273 /wd4804 /wd4834 /wd4996")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DISABLE_MSC_WARNINGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMSGPACK_NO_BOOST -DMSGPACK_DISABLE_LEGACY_NIL -DMSGPACK_DISABLE_LEGACY_CONVERT")
...
- Configure the above option, compile error:
include\opendht\infohash.h(254): error C2375: “dht::operator <<”: redefinition; different linkage
Modify include\opendht\infohash.h the following modifications of the following, You can compile and generate the OpenDHT library file.
...
// template <size_t M>
// OPENDHT_PUBLIC friend std::ostream& operator<< (std::ostream& s, const Hash<M>& h);
template <size_t M> friend std::ostream& operator<< (std::ostream& s, const Hash<M>& h);
...
// template <size_t N> std::ostream& operator<< (std::ostream& s, const Hash<N>& h)
template <size_t N>
OPENDHT_PUBLIC std::ostream& operator<< (std::ostream& s, const Hash<N>& h)
...
- After turning on OpenDHT_C option, compile the error:
opendht.cpp.obj : error LNK2001: unresolved external symbol "struct dht::HexMap const dht::hex_map" (?hex_map@dht@@3UHexMap@1@B)
opendht.cpp.obj : error LNK2001: unresolved external symbol "public: static struct dht::ValueType const dht::ValueType::USER_DATA" (?USER_DATA@ValueType@dht@@2U12@B)
Metadata
Metadata
Assignees
Labels
No labels