问题描述
我的朋友目前正在制作他自己的基于莱特币的加密货币。由于我有一个静态 IP,我将托管第一个节点。但是,我的“服务器”是树莓派,所以它的架构是 ARM。
但是当它开始编译 libbitcoin_server_a-rest.o 时,它给了我这个:rest.cpp: In function ‘bool rest_getutxos(HTTPRequest*,const string&)’: rest.cpp:557:38: error: ‘Pair’ was not declared in this scope objGetUTXOResponse.push_back(Pair("chainHeight",chainActive.Height()));
,代码如下:
case RF_JSON: {
UniValue objGetUTXOResponse(UniValue::VOBJ);
// pack in some essentials
// use more or less the same output as mentioned in Bip64
objGetUTXOResponse.push_back(Pair("chainHeight",chainActive.Height()));
objGetUTXOResponse.push_back(Pair("chaintipHash",chainActive.Tip()->GetBlockHash().GetHex()));
objGetUTXOResponse.push_back(Pair("bitmap",bitmapStringRepresentation));
UniValue utxos(UniValue::VARR);
for (const CCoin& coin : outs) {
UniValue utxo(UniValue::VOBJ);
utxo.push_back(Pair("height",(int32_t)coin.nHeight));
utxo.push_back(Pair("value",ValueFromAmount(coin.out.nValue)));
// include the script in a json output
UniValue o(UniValue::VOBJ);
ScriptPubKeyToUniv(coin.out.scriptPubKey,o,true);
utxo.push_back(Pair("scriptPubKey",o));
utxos.push_back(utxo);
}
objGetUTXOResponse.push_back(Pair("utxos",utxos));
// return json string
std::string strjson = objGetUTXOResponse.write() + "\n";
req->WriteHeader("Content-Type","application/json");
req->WriteReply(HTTP_OK,strjson);
return true;
}
所以我把所有 Pair
的东西都改成了 std::pair
,但后来我得到了 rest.cpp:558:47: error: missing template arguments before ‘(’ token objGetUTXOResponse.push_back(std::pair("chainHeight",chainActive.Height()));
。所以我在 <>
后面加了 std::pair
,但是编译器说我必须给出 2 个参数,因为我基本上对比特币和莱特币一无所知,所以我尝试了 <string,char>
,<char,int>
,但都报错了。
有谁知道如何在我的 Pi 4 上解决这个问题(因为它可以在他的 x64 机器上运行)?
PS:包含这些头文件:
#include "chain.h"
#include "chainparams.h"
#include "core_io.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "validation.h"
#include "httpserver.h"
#include "rpc/blockchain.h"
#include "rpc/server.h"
#include "streams.h"
#include "sync.h"
#include "txmempool.h"
#include "utilstrencodings.h"
#include "version.h"
#include <boost/algorithm/string.hpp>
#include <univalue.h>
#include <utility>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)