我已经在这两天了。 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/