Error while compiling bitcoin with qt support #7138

issue wilsonwang371 opened this issue on December 1, 2015
  1. wilsonwang371 commented at 12:01 AM on December 1, 2015: none

    The error details are:

    In file included from qt/clientmodel.cpp:5:0:
    qt/clientmodel.h: In function ‘void BlockTipChanged(ClientModel*, bool, const CBlockIndex*)’:
    qt/clientmodel.h:92:10: error: ‘void ClientModel::numBlocksChanged(int, const QDateTime&, double)’ is protected
         void numBlocksChanged(int count, const QDateTime& blockDate, double nVerificationProgress);
              ^
    qt/clientmodel.cpp:256:154: error: within this context
             Q_EMIT clientmodel->numBlocksChanged(pIndex->nHeight, QDateTime::fromTime_t(pIndex->GetBlockTime()), clientmodel->getVerificationProgress(pIndex));
                                                                                                                                                          ^
    

    It looks like a static function is trying to call a private method of ClientModel. There are two ways to fix this problem:

    1. Declare numBlocksChanged as a friend of class ClientModel.
    2. Add another public method to call line 256 instead of putting it in a static method outside class.

    I tried two approaches and both of them work. Which one is better?

    Btw, I am new here. I am trying to join bitcoin community and hope I can make more contributions.

  2. jonasschnelli commented at 4:49 AM on December 1, 2015: contributor

    Thanks for reporting. This was introduced with: #7112

    Methods 1) would be preferred I guess.

  3. jonasschnelli added the label Bug on Dec 1, 2015
  4. jonasschnelli added the label GUI on Dec 1, 2015
  5. jonasschnelli removed the label Bug on Dec 1, 2015
  6. laanwj added this to the milestone 0.12.0 on Dec 1, 2015
  7. laanwj commented at 8:53 AM on December 1, 2015: member

    Strange, why did none of our testing / Travis builds reveal this?

    Edit: OK, seems this only comes up for qt4.

  8. laanwj cross-referenced this on Dec 1, 2015 from issue bug, bitcoin-qt take clicking away from desktop by raedah
  9. laanwj referenced this in commit edf337d7fc on Dec 1, 2015
  10. laanwj cross-referenced this on Dec 1, 2015 from issue qt: use QMetaObject::invokeMethod for cross-thread signaling in clientmodel by laanwj
  11. laanwj commented at 10:49 AM on December 1, 2015: member

    See #7143

  12. laanwj referenced this in commit 6da12dff28 on Dec 1, 2015
  13. laanwj closed this on Dec 1, 2015

  14. bitcoin locked this on Sep 8, 2021

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-05-20 06:55 UTC