When I compiled C++ code with cmake and boost 1.64.0, a boost:: ASIO:: strand
error occurred.My OS is Ubuntu 18.04.
Here is my C++ Code:
#pragma once
// This file and the associated implementation has been placed in the public domain, waiving all copyright. No restrictions are placed on its use.
#include "Common/Defines.h"
#include <deque>
#include <mutex>
#include <future>
#include "Network/BtIOService.h"
namespace osuCrypto {
class WinNetIOService;
class ChannelBuffer;
class BtSocket
{
public:
BtSocket(BtIOService& ios);
boost::asio::ip::tcp::socket mHandle;
boost::asio::strand mSendStrand, mRecvStrand; //Error line
std::deque<BoostIOOperation> mSendQueue, mRecvQueue;
bool mStopped;
std::atomic<u64> mOutstandingSendData, mMaxOutstandingSendData, mTotalSentData, mTotalRecvData;
};
}
ERROR infomation:
In file included from /root/project/MultipartyPSI/MultipartyPSI/cryptoTools/Network/BtAcceptor.h:8:0,
from /root/project/MultipartyPSI/MultipartyPSI/cryptoTools/Network/BtEndpoint.h:5,
from /root/project/MultipartyPSI/MultipartyPSI/frontend/OtBinMain.cpp:1:
/root/project/MultipartyPSI/MultipartyPSI/cryptoTools/Network/BtSocket.h:76:9: error: invalid use of template-name ‘boost::asio::strand’ without an argument list
boost::asio::strand mSendStrand, mRecvStrand;
^~~~~
compilation terminated due to -Wfatal-errors.
If you have any original views on this problem, please help me.
2
Answers
When i use
boost::asio::io_service::strand
the error no longer occurs。 For the documented interface changes see: Networking TS compatibilityThe interface for strands changed.
The simplest approach here will be to change
strand
intoany_io_executor
which can hold … any executor, including a strand.For the documented interface changes see: Networking TS compatibility