I am trying to compile an altcoin QT wallet on a SolydK system. No matter what I try it always fails with
...
g++ -c -pipe -fstack-protector-all --param ssp-buffer-size=1 -D_FORTIFY_SOURCE=2 -O2 -D_REENTRANT -fdiagnostics-show-option -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -Wno-unused-variable -fpermissive -Wno-unused-local-typedefs -fPIE -DENABLE_WALLET -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DQT_DISABLE_DEPRECATED_BEFORE=0 -DBOOST_VARIANT_USE_RELAXED_GET_BY_DEFAULT -DUSE_DBUS -DHAVE_BUILD_INFO -DLINUX -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_DBUS_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/i386-linux-gnu/qt5/mkspecs/linux-g++ -Isrc -Isrc/json -Isrc/qt -Isrc/qt/plugins/mrichtexteditor -Isrc/leveldb/include -Isrc/leveldb/helpers -Isrc/secp256k1/include -Idb4/include -isystem /usr/include/i386-linux-gnu/qt5 -isystem /usr/include/i386-linux-gnu/qt5/QtPrintSupport -isystem /usr/include/i386-linux-gnu/qt5/QtWidgets -isystem /usr/include/i386-linux-gnu/qt5/QtDBus -isystem /usr/include/i386-linux-gnu/qt5/QtNetwork -isystem /usr/include/i386-linux-gnu/qt5/QtGui -isystem /usr/include/i386-linux-gnu/qt5/QtCore -Ibuild -Ibuild -o build/bitcoin.o src/qt/bitcoin.cpp
In file included from src/wallet.h:8:0,
from src/qt/walletmodel.h:12,
from src/qt/bitcoin.cpp:9:
src/walletdb.h:96:1: error: expected class-name before ‘{’ token
{
^
In file included from src/wallet.h:8:0,
from src/qt/walletmodel.h:12,
from src/qt/bitcoin.cpp:9:
src/walletdb.h:153:25: error: ‘CDBEnv’ has not been declared
static bool Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys);
^
src/walletdb.h:154:25: error: ‘CDBEnv’ has not been declared
static bool Recover(CDBEnv& dbenv, std::string filename);
^
In file included from src/wallet.h:8:0,
from src/qt/walletmodel.h:12,
from src/qt/bitcoin.cpp:9:
src/walletdb.h: In constructor ‘CWalletDB::CWalletDB(const string&, const char*)’:
src/walletdb.h:98:77: error: class ‘CWalletDB’ does not have any field named ‘CDB’
CWalletDB(const std::string& strFilename, const char* pszMode = "r+") : CDB(strFilename, pszMode)
^
make: *** [build/bitcoin.o] Error 1
I gather it's a class inheritance error. But the exact same source (pulled from github) compiles fine on Mint 17.3 (Ubuntu 14.04 LTS) and Xubuntu 16.04 LTS systems. There are 752 SO questions regarding "error: expected class-name before ‘{’ token" but none are for bitcoin.cpp or walletdb.h.
I don't believe it's a Qt problem; I get the same error whether using Qt4 or Qt5 on the SolydK system. I also get the same error if trying to build the daemon instead of the GUI wallet (in which case the error comes when compiling init.cpp). The offending section of the named walletdb.h is
...
94 /** Access to the wallet database (wallet.dat) */
95 class CWalletDB : public CDB
96 {
97 public:
98 CWalletDB(const std::string& strFilename, const char* pszMode = "r+") : CDB(strFilename, pszMode)
99 {
100 }
101 private:
102 CWalletDB(const CWalletDB&);
103 void operator=(const CWalletDB&);
104 public:
105 bool WriteName(const std::string& strAddress, const std::string& strName );
106
107 bool EraseName(const std::string& strAddress);
...
I wondered if it's something to do with different default options for the different compiler versions. On Mint I have
mark gbx $ g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
On Xubuntu it is
mark@xubuntu:~/src/EarnzCoin$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
and on the failing SolydK it is
mark@traveller ~/src/EarnzCoin $ g++ --version
g++ (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
But I can't see any obvious significant differences (eg: value for --std) using g++ --dumpspecs nor in the qmake generated Makefiles.
About half a dozen other altcoins compile fine on the SolydK system.
This isn't my code, I haven't changed it at all, just trying to compile it. There are no Google hits for this inheritance error with bitcoin.cpp or walletdb.h
I'm not a C++ programmer, don't want to be. No-one else has reported this error anywhere I can find it so it's probably something related to my SolydK system, but I don't know what.
Any suggestions for other things to check/try?