libbitcoin / libbitcoin-system

Bitcoin Cross-Platform C++ Development Toolkit
https://libbitcoin.info/
Other
1.3k stars 379 forks source link

quickstart does not compile #432

Closed PhGalaz closed 8 years ago

PhGalaz commented 8 years ago

Dear community, I can get rid of this error trying to compile the quickstart code.

error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

(plus many many more lines of errors)

I'm in Ubuntu 16.04 and I don't know what else to tell you. Any help would be truly appreciated. Thanks!

narodnik commented 8 years ago

Can you try this?

g++ $(pkg-config --cflags --libs libbitcoin)

Hope that works.

PhGalaz:

Dear community, I can get rid of this error trying to compile the quickstart code.

error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

(plus many many more lines of errors)

I'm in Ubuntu 16.04 and I don't know what else to tell you. Any help would be truly appreciated. Thanks!

evoskuil commented 8 years ago

Hi @PhGalaz - what do you mean by "quickstart code"? Are you invoking install.sh or are you using the direct Autotools installation? In either case the required flags are set in configure.ac. You can check your installed compiler version using these instructions.

PhGalaz commented 8 years ago

Thanks a lot guys, this is what I am doing: http://libbitcoin.dyne.org/doc/quickstart.html RojavaCrypto's commands show the same results. evoskuil, I'm very sorry but I'm pretty new in this world and I don't understand your instructions pretty well. All I'm doing is running those commands after libbitcoin installation. I did everything on https://github.com/libbitcoin/libbitcoin#debianubuntu tho. Any other thoughts?

evoskuil commented 8 years ago

Okay, the dyne site is sometimes dated. The compile requires the additional flag as indicated by the error message.

This flag is no longer included in the package config because it breaks compilation of libraries with .c files, ultimately a limitation of package config.

PhGalaz commented 8 years ago

phhidalgo@ubuntu:~/Desktop/libbitcoin$ g++ -std=gnu++11 test.cpp $(pkg-config --cflags --libs libbitcoin) <<< is the flag properly added? /tmp/ccJXqJH0.o: In function main': test.cpp:(.text+0x72): undefined reference tolibbitcoin::encode_hex(libbitcoin::array_slice)' collect2: error: ld returned 1 exit status phhidalgo@ubuntu:~/Desktop/libbitcoin$ g++ -std=c++11 test.cpp $(pkg-config --cflags --libs libbitcoin) /tmp/ccTDSfHj.o: In function main': test.cpp:(.text+0x72): undefined reference tolibbitcoin::encode_hex(libbitcoin::array_slice)' collect2: error: ld returned 1 exit status

PhGalaz commented 8 years ago

Thanks evoskuil

evoskuil commented 8 years ago

NP. The error is again the result of the site being a bit dated. The format functions were rationalized for the v2 release. The term "hex" is no longer used.

PhGalaz commented 8 years ago

Are you saying then that is the code what is not good? the file itself? Where can I find actual examples? I have a fundamental question, I want to use hd wallet from libbitcoin for example, but I'm not well versed on C++, I can read better Python. In order to use the functionality of libbitcoin I have to code in C++ right? Can I call libbitcoin commands from other language and pick up returns? I'm not sure how can I use libbitcoin, how I can operate with it. I have search a lot but if you know a good fount please let me know. Thanks again for your help.

evoskuil commented 8 years ago

The code example is not current (three invalid functions and a missing flag on the command line). Examples for libbitcoin are limited. The libbitcoin-explorer library is a good demonstration of the lower level capabilities of libbitcoin. I recommend reviewing that source for the particular wallet commands of interest. The command line documentation for bx is excellent and there are precompiled versions to work with. The per-command source code is very small and easy to follow.

There are efforts both to produce Python wrappers and to significantly improve documentation. As far as I know the only current documentation is on the GitHub site.