src/walletdb.h:96:1:错误:"{"标记之前的预期类名
src/walletdb.h:96:1: error: expected class-name before ‘{’ token
我正在尝试在SolydK系统上编译山寨币QT钱包。无论我尝试什么,它总是失败
...
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
我收集这是一个类继承错误。但是完全相同的源代码(从github中提取)在Mint 17.3(Ubuntu 14.04 LTS)和Xubuntu 16.04 LTS系统上编译得很好。有752个关于"错误:'{'令牌之前的预期类名"的SO问题,但没有一个是针对比特币.cpp或walletdb.h的。
我不认为这是一个Qt问题;无论是在 SolydK 系统上使用 Qt4 还是 Qt5,我都会收到相同的错误。如果尝试构建守护程序而不是 GUI 钱包,我也会遇到同样的错误(在这种情况下,编译 init.cpp 时会出现错误)。命名的walletdb.h的违规部分是
...
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);
...
我想知道这是否与不同编译器版本的不同默认选项有关。在薄荷上,我有
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.
在 Xubuntu 上它是
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.
在失败的SolydK上,它是
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.
但是我看不到任何明显的显着差异(例如:--std的值)使用g ++ --dumpspecs或在qmake生成的Makefiles中。
大约有六个其他山寨币在SolydK系统上编译得很好。
这不是我的代码,我根本没有改变它,只是试图编译它。比特币或walletdb.h的这个继承错误没有谷歌点击.cpp
我不是一个C++程序员,不想成为。没有其他人在我能找到的任何地方报告此错误,因此它可能与我的SolydK系统有关,但我不知道是什么。
对其他检查/尝试的事情有什么建议吗?
似乎缺少基类CDB
(标头不可用或未包含)。检查它是否是外部包,并在必要时安装开发文件。如果不是,则可能存在某个#define
,使该类在该特定系统上不可用,例如,因为缺少先决条件。
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- boost::进程间消息队列引发错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- QT在错误的班级中寻找空位
- vector.resize()中的分配错误
- 代码在main()中运行,但在函数中出现错误
- 释放错误后堆使用
- (C++)分析树以计算返回错误值的简单算术表达式
- Project Euler问题4的错误解决方案
- 我的字符计数代码计算错误.为什么
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 尝试导入pybind-opencv模块时出现libgtk错误
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- 在某些循环内使用vector.push_back时出现分段错误
- MSVC多行宏编译器错误
- Arduino IDE 错误 - 无法找到数字文字运算符"运算符""f900ff"
- '&lt;'''&lt;'''&quot的模板类错误''令牌”
- 错误消息:"jj"的名称查找已更改为ISO"for"范围,(如果您使用"