Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityAnybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
I build an Android wallet for Bitcoin so I need to link libbitcoin-system as a library to my CMake project to use it. I built libbitcoin-system with build_all.bat in Windows as instructed in https://github.com/libbitcoin/libbitcoin-system#windows. It then generate libbitcoin-system.lib file at bin/x64/Release/v141/static, I checked it with lib /list command to contain obj files. Add libbitcoin-system.lib to CMake project
cmake_minimum_required (VERSION 3.8) set(VS150COMNTOOLS "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/Common7/Tools") project ("test") # Add libbitcoin set(Libbitcoin_INCLUDE_DIR "H:/CProject/libbitcoin-system/include") set(Libbitcoin_LIBRARY_DIR "H:/CProject/libbitcoin-system/bin/x64/Release/v141/static") include_directories(${Libbitcoin_INCLUDE_DIR}) find_library(libbitcoin libbitcoin-system ${Libbitcoin_LIBRARY_DIR}) # Add boost SET (BOOST_ROOT "H:/New Download/boost_1_72_0/boost_1_72_0") SET (BOOST_LIBRARYDIR "H:/New Download/boost_1_72_0/boost_1_72_0/stage/lib") set(Boost_COMPILER "-vc141") set(Boost_USE_STATIC_LIBS ON) # only find static libs set(Boost_USE_DEBUG_LIBS ON) # ignore debug libs and set(Boost_USE_RELEASE_LIBS OFF) # only find release libs set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) find_package(Boost "1.72.0" EXACT REQUIRED COMPONENTS thread date_time chrono regex filesystem iostreams program_options log log_setup atomic locale) if (Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) endif() # Add source to this project's executable. add_executable (test "test.cpp" "test.h") add_compile_definitions(LIBBITCOIN_STATIC_LIBRARY) target_link_libraries(test ${libbitcoin} ${Boost_LIBRARIES})
Then I build the project with errors
H:\CProject\test\test\out\build\x64-Debug\test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl libbitcoin::config::checkpoint::checkpoint(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned __int64)" (__imp_??0checkpoint@config@libbitcoin@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_K@Z) referenced in function "void __cdecl libbitcoin::`dynamic initializer for 'mainnet_bip16_exception_checkpoint''(void)" (??__Emainnet_bip16_exception_checkpoint@libbitcoin@@YAXXZ) H:\CProject\test\test\out\build\x64-Debug\test.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static unsigned char const libbitcoin::machine::number::negative_mask" (__imp_?negative_mask@number@machine@libbitcoin@@2EB) H:\CProject\test\test\out\build\x64-Debug\Debug\test.exe : fatal error LNK1120: 2 unresolved externals
Is there any missing configuration in the project or I have to modify the build of libbitcoin-system.lib? Thanks so much
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments