3

I want to experiment with Bitcoin's code (both Core and Unlimited, if it makes a difference).

I really wanted to use CLion, but was unable to compile it and make it work (something to do with using a different Make?)

I am weaker on the "setting up stuff" side, and I usually don't use C++, so a detailed explanation how to do something like printing "Hello World" every time a new block is received will be my dream come true.

Thanks!

2 Answers 2

5

Bitcoin Core uses the autotools build system, but CLion only supports projects using CMake, so you can't use Core with CLion. You should be able to use Core with Eclipse CDT and NetBeans as those support Autotools. You may need to do some special configuring for it to work properly. Most people who work on Core just use text editors, command line build commands, and gdb instead of an actual IDE (at least that is what I use, and I have heard some others do too).

If you want to add debugging print statements to the code, just add lines like this:

fprintf(stderr, "some text here\n");

and that will print some text here to the terminal if you are running it from the terminal. fprintf is a standard C function so you can look up how to use it to include more information in the output.

2

There is an issue in the Bitcoin Core repo on the existing IDE options. Apparently it is/was possible to use CLion in debug mode but gdb or lldb are generally recommended for line by line debugging.

There has been discussion about swapping out the existing MSVC build to use CMake but at the time of writing (September 2020) there is no open PR to do this.

Many Bitcoin Core contributors don't use IDEs. Personally I am using Vim with this configuration for additional features. I would recommend you do similar as it doesn't seem like supporting IDEs like CLion is a priority for Bitcoin Core contributors currently.

February 2021 update: sipa uses mcedit, wumpus uses neovim in combination with this automated tool to fix formatting issues

There is a PR from kiminuo to add an EditorConfig file to Bitcoin Core to help with coding style issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.