I've spent some time to check this out and I've made it work. I'm a bit rusty with C++ since I do mostly C# for many years and I've obviously did it under Windoze, but here we are:
1. I've used Visual Studio 2017 Community edition, because that's what I already had.
2. I've copied (as zip) libbitcoin from git, unpacked, opened the .sln from vs2017 folder.
3. Removed libbitcoin-system-test project from our sln because it's for no use now.
4. Allowed the NuGet packages get downloaded (here you may have made 2 mistakes: a. using newer versions than required, b. not getting all of those packages)
5. Compiled only the library.
6. Modified the libbitcoin-system-examples project for proper paths
6.1: Properties/C-C++/General/Additional include dirs: added the exact full path to the
include folder since I've noticed that it's not taken correctly into account as it was
6.2: Properties/Linker/General/Additional library directories: added the exact full path to the folder the library (libbitcoin-system.lib) was created/built.
7. Modified the main.cpp of libbitcoin-system-examples for our use (yes, I'm lazy), by pasting the content of addr.cpp over it
8. Did some corrections in order to compile it, I'll put the current code without comments:
#include <bitcoin/system.hpp>
BC_USE_LIBBITCOIN_MAIN
int bc::system::main(int argc, char* argv[])
{
bc::system::ec_secret decoded;
bc::system::decode_base16(decoded,
"038109007313a5807b2eccc082c8c3fbb988a973cacf1a7df9ce725c31b14776");
bc::system::wallet::ec_private secret(
decoded, bc::system::wallet::ec_private::mainnet_p2kh, true);
bc::system::wallet::ec_public public_key(secret);
std::cout << "Public key: " << public_key.encoded() << std::endl;
bc::system::data_chunk public_key_data;
public_key.to_data(public_key_data);
const auto hash = bc::system::bitcoin_short_hash(public_key_data);
bc::system::data_chunk unencoded_address;
unencoded_address.reserve(25);
unencoded_address.push_back(0);
bc::system::extend_data(unencoded_address, hash);
bc::system::append_checksum(unencoded_address);
assert(unencoded_address.size() == 25);
const std::string address = bc::system::encode_base58(unencoded_address);
std::cout << "Address: " << address << std::endl;
return 0;
}
I hope I didn't forget anything, it compiles now. If you want to run it, don't forget to set libbitcoin-system-examples as starting project if you want to run it step by step.
If something is unclear, shoot
Good luck!