c++ - 新 arg 在不同的 arg 上生成错误

标签 c++

我已经在这两天了。 CreateTransaction 的第 7 个参数是代码中的新参数,并且在程序其他地方的调用中已成功使用。

在 FundTransaction 中使用以下内容创建一个空字符串。

std::string strTxComment;

然后传入。

CreateTransaction(vecSend, wtx, reservekey, nFeeRet, nChangePosRet, strFailReason, strTxComment, coinControl, false)

里面有定义。

bool CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, int& nChangePosRet, std::string& strFailReason, std::string strTxComment, const CCoinControl *coinControl = NULL, bool sign = true);

然后我们得到以下错误,它提示第 9 个 arg 而不是新的第 7 个 strTxComment arg。

wallet/wallet.cpp: In member function ‘bool CWallet::FundTransaction(CMutableTransaction&, CAmount&, int&, std::string&, bool)’:
wallet/wallet.cpp:1927:125: error: no matching function for call to ‘CWallet::CreateTransaction(std::vector<CRecipient>&, CWalletTx&, CReserveKey&, CAmount&, int&, std::string&, std::string&, CCoinControl&, bool)’
 if (!CreateTransaction(vecSend, wtx, reservekey, nFeeRet, nChangePosRet, strFailReason, strTxComment, coinControl, false))
                                                                                                                         ^
wallet/wallet.cpp:1927:125: note: candidate is:
In file included from wallet/wallet.cpp:6:0:
./wallet/wallet.h:670:10: note: bool CWallet::CreateTransaction(const std::vector<CRecipient>&, CWalletTx&, CReserveKey&, CAmount&, int&, std::string&, std::string&, const CCoinControl*, bool)
 bool CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, int& nChangePosRet, std::string& strFailReason, std::string strTxComment, const CCoinControl *coinControl = NULL, bool sign = true);
      ^
./wallet/wallet.h:670:10: note:   no known conversion for argument 8 from ‘CCoinControl’ to ‘const CCoinControl*’

将更改之前的代码还原为 CreateTransaction,FundTransaction 以完全相同的方式调用它,但没有更改 coinControl 参数。

我不期待解决方案,但此时我需要一些帮助,因为我非常困难。

最佳答案

您没有向我们展示 coinControl,但它似乎不是一个指针。尝试发送

&coinControl

关于c++ - 新 arg 在不同的 arg 上生成错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40190066/

相关文章:

c++ - 如何在 Qt 上实现 GDAL 库?

c++ - 在 Windows 上开始使用 OpenGL ES 2.0

c++ - Ofstream 在 Linux 上写入空文件

c++ - 显示链接列表

c++ - 用于映射一对一关系的 STL 类型?

c++ - 在 C++ 中从 String 转换为 Double 的奇怪之处

c++ - 在 C 程序中调用 C++ 共享库...如何管理?

单变量初始化的 C++ 风格

c++ - 根据当前主题重新着色图像?

c++ - 使用 CallAfter 调用 wxWindow::Destroy 会产生编译时错误