Closed klemenpeganc closed 3 years ago
hi,
I have not tried to compile this code for windows, but I think there should be no problems because there is nothing platform-dependent in the code...
Hi, thanks for your answer. The problem occurs when linking additional libraries: target_link_libraries( ${PROJECT_NAME} z crypto ssl pthread )
What would the windows equivalent be of this?
z
- zlib
crypto
and ssl
- openssl
pthread
- just ignore it
this worked, I managed to get it to build. However, now every API function call results in: can't dereference value-initialized vector iterator
Call stack:
hmm... could you provide me the sample code that leads to this error?
binapi::rest::api api(
ioctx
,"api.binance.com"
,"443"
, API_KEY
, PRIVATE_KEY
,10000
);
auto server_time = api.server_time();
It crashes in flatjson.hpp, line 1451: m_end = &(*m_storage->end()); Contents of m_storage:
This is the state just before line 1451 is executed.
which compiler are you using?
MSVC 19.22.27905.0
I don't have access to the Windows machine, but I'll try to figure it out...
Thanks, appreciate it! I will try using Clang in the meantime. I will let you know how it goes
Just wanted to let you know, that it fully works using MSVC in Release mode.
fixed: https://github.com/niXman/flatjson/commit/617d4cbaf6b1aea1e1ec47a1799952f8197dccb4
please confirm.
@klemenpeganc can you let me know how you built this on windows with setting up all the libs? Thanks
I used vcpkg for the libraries and my CMakeLists.txt file looks like this:
project(binapi)
set(CMAKE_CXX_STANDARD 14)
include(path/to/vcpkg.cmake)
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
add_definitions(
-UNDEBUG
-DDTF_HEADER_ONLY
-D__FLATJSON__CHILDS_TYPE=std::uint32_t
-D__FLATJSON__VLEN_TYPE=std::uint32_t
)
include_directories(
./include
)
include_directories("path/to/boost/folder")
link_directories("path/to/boost/libs")
set(BINAPI_HEADERS
binapi/api.hpp
binapi/flatjson.hpp
binapi/dtf.hpp
binapi/double_type.hpp
binapi/invoker.hpp
binapi/io_state.hpp
binapi/message.hpp
binapi/pairslist.hpp
binapi/reports.hpp
binapi/tools.hpp
binapi/types.hpp
binapi/websocket.hpp
)
set(BINAPI_SOURCES
src/api.cpp
src/io_state.cpp
src/pairslist.cpp
src/reports.cpp
src/tools.cpp
src/types.cpp
src/websocket.cpp
)
add_executable(
${PROJECT_NAME}
#
main.cpp
#
${BINAPI_SOURCES}
)
target_link_libraries(
${PROJECT_NAME}
ZLIB::ZLIB
OpenSSL::SSL
OpenSSL::Crypto
)
Hi, any chance you could provide the changes needed to compile this on windows?