Linking error when using bitcoin libs #21050

issue liorko87 opened this issue on February 1, 2021
  1. liorko87 commented at 9:17 AM on February 1, 2021: none

    <!-- This issue tracker is only for technical issues related to Bitcoin Core. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com. For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/. If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! Any report, issue or feature request related to the GUI should be reported at https://github.com/bitcoin-core/gui/issues/ -->

    <!-- Describe the issue -->

    I'm trying to build a protocol that uses bitcoin headers and libraries. When I'm creating a PKhash object from a publick key, I'm receiving this error:

    /usr/bin/ld: /home/user/bitcoin/src/libbitcoin_common.a(libbitcoin_common_a-standard.o): in function `CHash160::CHash160()':
    /home/user/bitcoin/src/./hash.h:46: undefined reference to `CSHA256::CSHA256()'
    

    The code I created the hash from it from:

    std::vector<unsigned char >byteRepr(tag.c_str(), tag.c_str() + tag.length());
    CPubKey key(byteRepr);
    PKHash hash (key);
    

    My CMake file:

    cmake_minimum_required(VERSION 3.16)
    project(Bitcoinextension)
    
    set(CMAKE_CXX_STANDARD 11)
    set(${CMAKE_CXX_FLAGS} "${CMAKE_CXX_FLAGS} -g3")
    
    include_directories($ENV{HOME}/bitcoin/src $ENV{HOME}/bitcoin/depends/x86_64-pc-linux-gnu/include)
    link_directories($ENV{HOME}/bitcoin/src)
    
    add_executable(Bitcoinextension main.cpp Pob.cpp Address.cpp)
    
    target_link_libraries(Bitcoinextension ssl crypto
            $ENV{HOME}/bitcoin/src/libbitcoin_common.a
            $ENV{HOME}/bitcoin/src/libbitcoin_consensus.a
            $ENV{HOME}/bitcoin/src/libbitcoin_cli.a)
    
    

    <!--- What behavior did you expect? -->

    <!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->

    <!--- How reliably can you reproduce the issue, what are the steps to do so? -->

    <!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

    <!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

    <!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->

    <!-- Any extra information that might be useful in the debugging process. -->

    <!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

  2. MarcoFalke commented at 9:19 AM on February 1, 2021: member

    Usually the issue tracker is used to track technical issues related to the Bitcoin Core code base. General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange or the #bitcoin IRC channel on freenode.

  3. MarcoFalke closed this on Feb 1, 2021

  4. DrahtBot locked this on Aug 18, 2022
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-25 18:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me