Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namecoin Core 23.0 fails compiling Qt #515

Open
ghost opened this issue May 26, 2022 · 8 comments
Open

Namecoin Core 23.0 fails compiling Qt #515

ghost opened this issue May 26, 2022 · 8 comments

Comments

@ghost
Copy link

ghost commented May 26, 2022

In file included from qt/buynamespage.cpp:1:
./qt/buynamespage.h:33:57: error: ‘optional’ in namespace ‘std’ does not name a template type
   33 |     QString firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const;
      |                                                         ^~~~~~~~
./qt/buynamespage.h:7:1: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
    6 | #include <QWidget>
  +++ |+#include <optional>
    7 | 
./qt/buynamespage.h:33:65: error: expected ‘,’ or ‘...’ before ‘<’ token
   33 |     QString firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const;
      |                                                                 ^
In file included from qt/buynamespage.cpp:1:
./qt/buynamespage.h:36:10: warning: ‘virtual bool BuyNamesPage::eventFilter(QObject*, QEvent*)’ can be marked override [-Wsuggest-override]
   36 |     bool eventFilter(QObject *object, QEvent *event);
      |          ^~~~~~~~~~~
qt/buynamespage.cpp: In member function ‘void BuyNamesPage::onRegisterNameAction()’:
qt/buynamespage.cpp:71:46: error: no matching function for call to ‘BuyNamesPage::firstupdate(QString&, const QString&, const std::optional<QString>&)’
   71 |     const QString err_msg = this->firstupdate(name, newValue, transferToAddress);
      |                             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from qt/buynamespage.cpp:1:
./qt/buynamespage.h:33:13: note: candidate: ‘QString BuyNamesPage::firstupdate(const QString&, int) const’
   33 |     QString firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const;
      |             ^~~~~~~~~~~
./qt/buynamespage.h:33:13: note:   candidate expects 2 arguments, 3 provided
qt/buynamespage.cpp: At global scope:
qt/buynamespage.cpp:83:9: error: no declaration matches ‘QString BuyNamesPage::firstupdate(const QString&, const std::optional<QString>&, const std::optional<QString>&) const’
   83 | QString BuyNamesPage::firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const
      |         ^~~~~~~~~~~~
In file included from qt/buynamespage.cpp:1:
./qt/buynamespage.h:33:13: note: candidate is: ‘QString BuyNamesPage::firstupdate(const QString&, int) const’
   33 |     QString firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const;
      |             ^~~~~~~~~~~
./qt/buynamespage.h:18:7: note: ‘class BuyNamesPage’ defined here
   18 | class BuyNamesPage : public QWidget
      |       ^~~~~~~~~~~~
make[2]: *** [Makefile:12469: qt/libbitcoinqt_a-buynamespage.o] Error 1
make[2]: Leaving directory '/home/hacker/namecoin-core-nc23.0/src'
make[1]: *** [Makefile:17862: all-recursive] Error 1
make[1]: Leaving directory '/home/hacker/namecoin-core-nc23.0/src'
make: *** [Makefile:815: all-recursive] Error 1
@domob1812
Copy link

Probably a missing #include <optional> (which is fixed in master).

@ncopa
Copy link

ncopa commented Jul 29, 2022

I don't think its fixed in master. This fixes it:

diff --git a/src/qt/buynamespage.h b/src/qt/buynamespage.h                                                      
index 03a565c..1aa3097 100644                                                                                   
--- a/src/qt/buynamespage.h                                                                                     
+++ b/src/qt/buynamespage.h                                                                                     
@@ -5,6 +5,8 @@                                                                                                 
                                                                                                                
 #include <QWidget>                                                                                             
                                                                                                                
+#include <optional>                                                                                            
+                                                                                                               
 class WalletModel;                                                                                             
                                                                                                                
 namespace Ui {                                                                                                 

@JeremyRand
Copy link
Member

JeremyRand commented Oct 20, 2022

Hi @ncopa , thanks for the patch. Would you mind creating a PR for that, so that we can review it properly? It definitely looks like this bug only gets tickled in certain cases, and for whatever reason it doesn't get tickled in either my personal build VM or Guix, but as long as the PR is obviously correct, I'm not too worried about figuring out how to reproduce the bug on my end -- adding an #include doesn't need that much review.

EDIT: Also apologies for missing your patch when you posted it; your comment was posted while I had COVID. :(

JeremyRand pushed a commit that referenced this issue Jan 6, 2023
53a0fe5 Missing #include in buynamespage.h (Red Army Fraction)

Pull request description:

  Both Namecoin Core 23.0 (#515) and 24.0, as shown below, fail to compile due to a missing #include.

  This pull request resolves the issue in Namecoin Core 24.0 and subsequent releases.

  ~~~
  In file included from qt/buynamespage.cpp:1:
  ./qt/buynamespage.h:34:57: error: ‘optional’ in namespace ‘std’ does not name a template type
     34 |     QString firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const;
        |                                                         ^~~~~~~~
  ./qt/buynamespage.h:7:1: note: ‘std::optional’ is defined in header ‘<optional>’; did you forget to ‘#include <optional>’?
      6 | #include <QWidget>
    +++ |+#include <optional>
      7 |
  ./qt/buynamespage.h:34:65: error: expected ‘,’ or ‘...’ before ‘<’ token
     34 |     QString firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const;
        |                                                                 ^
  ./qt/buynamespage.h:37:10: warning: ‘virtual bool BuyNamesPage::eventFilter(QObject*, QEvent*)’ can be marked override [-Wsuggest-override]
     37 |     bool eventFilter(QObject *object, QEvent *event);
        |          ^~~~~~~~~~~
  qt/buynamespage.cpp: In member function ‘void BuyNamesPage::onRegisterNameAction()’:
  qt/buynamespage.cpp:95:46: error: no matching function for call to ‘BuyNamesPage::firstupdate(QString&, const QString&, const std::optional<QString>&)’
     95 |     const QString err_msg = this->firstupdate(name, newValue, transferToAddress);
        |                             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ./qt/buynamespage.h:34:13: note: candidate: ‘QString BuyNamesPage::firstupdate(const QString&, int) const’
     34 |     QString firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const;
        |             ^~~~~~~~~~~
  ./qt/buynamespage.h:34:13: note:   candidate expects 2 arguments, 3 provided
  qt/buynamespage.cpp: At global scope:
  qt/buynamespage.cpp:142:9: error: no declaration matches ‘QString BuyNamesPage::firstupdate(const QString&, const std::optional<QString>&, const std::optional<QString>&) const’
    142 | QString BuyNamesPage::firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const
        |         ^~~~~~~~~~~~
  ./qt/buynamespage.h:34:13: note: candidate is: ‘QString BuyNamesPage::firstupdate(const QString&, int) const’
     34 |     QString firstupdate(const QString &name, const std::optional<QString> &value, const std::optional<QString> &transferTo) const;
        |             ^~~~~~~~~~~
  ./qt/buynamespage.h:18:7: note: ‘class BuyNamesPage’ defined here
     18 | class BuyNamesPage : public QWidget
        |       ^~~~~~~~~~~~
  make[2]: *** [Makefile:12660: qt/libbitcoinqt_a-buynamespage.o] Error 1
  make[2]: Leaving directory '/home/hacker/namecoin-core-nc24.0/src'
  make[1]: *** [Makefile:19356: all-recursive] Error 1
  make[1]: Leaving directory '/home/hacker/namecoin-core-nc24.0/src'
  make: *** [Makefile:823: all-recursive] Error 1
  ~~~

ACKs for top commit:
  JeremyRand:
    ACK 53a0fe5

Tree-SHA512: cb18cd9fc326a45c9379357c8bea828aa04fc64d481fe669055c97c3963291fa27a08c479b9c83f77f3c2ece2ce67d28eba2c0edd59b214af1ba41906c1dfb67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@ncopa @JeremyRand @domob1812 and others