Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在boost v1.58中调用函数时,模板名称使用无效错误 我有一个小型的C++项目,它使用Boost库(版本1.58),当调用Boosi::asi::Struts时,会出错。我的语法似乎是错误的,但我不知道怎么做 #pragma once #ifndef TCPNETWORK_H_ #define TCPNETWORK_H_ //----------------------------------------------------------------------------- #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/enable_shared_from_this.hpp> #include <boost/shared_ptr.hpp> #include <string> #include <vector> #include <list> #include <boost/cstdint.hpp> //----------------------------------------------------------------------------- using boost::uint32_t; using boost::uint16_t; using boost::uint8_t; using boost::int32_t; using boost::int16_t; using boost::int8_t; //----------------------------------------------------------------------------- class Hive; class Acceptor; //class Connection; //----------------------------------------------------------------------------- class Connection : public boost::enable_shared_from_this< Connection > { friend class Acceptor; friend class Hive; private: boost::shared_ptr< Hive > m_hive; boost::asio::ip::tcp::socket m_socket; boost::asio::strand m_io_strand; boost::posix_time::ptime m_last_time; std::vector< uint8_t > m_recv_buffer; std::list< int32_t > m_pending_recvs; std::list< std::vector< uint8_t > > m_pending_sends; int32_t m_receive_buffer_size; boost::asio::deadline_timer m_retryTimer ; int32_t m_retryTimerInterval; boost::asio::deadline_timer m_connectTimer; int32_t m_connectTimerInterval; boost::asio::deadline_timer m_sendTimer; int32_t m_sendTimerInterval; void DispatchSendTimer( const boost::system::error_code & error ); void HandleSendTimer( const boost::system::error_code & error ); volatile uint32_t m_error_state;_C++_Eclipse_Boost - Fatal编程技术网

在boost v1.58中调用函数时,模板名称使用无效错误 我有一个小型的C++项目,它使用Boost库(版本1.58),当调用Boosi::asi::Struts时,会出错。我的语法似乎是错误的,但我不知道怎么做 #pragma once #ifndef TCPNETWORK_H_ #define TCPNETWORK_H_ //----------------------------------------------------------------------------- #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/enable_shared_from_this.hpp> #include <boost/shared_ptr.hpp> #include <string> #include <vector> #include <list> #include <boost/cstdint.hpp> //----------------------------------------------------------------------------- using boost::uint32_t; using boost::uint16_t; using boost::uint8_t; using boost::int32_t; using boost::int16_t; using boost::int8_t; //----------------------------------------------------------------------------- class Hive; class Acceptor; //class Connection; //----------------------------------------------------------------------------- class Connection : public boost::enable_shared_from_this< Connection > { friend class Acceptor; friend class Hive; private: boost::shared_ptr< Hive > m_hive; boost::asio::ip::tcp::socket m_socket; boost::asio::strand m_io_strand; boost::posix_time::ptime m_last_time; std::vector< uint8_t > m_recv_buffer; std::list< int32_t > m_pending_recvs; std::list< std::vector< uint8_t > > m_pending_sends; int32_t m_receive_buffer_size; boost::asio::deadline_timer m_retryTimer ; int32_t m_retryTimerInterval; boost::asio::deadline_timer m_connectTimer; int32_t m_connectTimerInterval; boost::asio::deadline_timer m_sendTimer; int32_t m_sendTimerInterval; void DispatchSendTimer( const boost::system::error_code & error ); void HandleSendTimer( const boost::system::error_code & error ); volatile uint32_t m_error_state;

在boost v1.58中调用函数时,模板名称使用无效错误 我有一个小型的C++项目,它使用Boost库(版本1.58),当调用Boosi::asi::Struts时,会出错。我的语法似乎是错误的,但我不知道怎么做 #pragma once #ifndef TCPNETWORK_H_ #define TCPNETWORK_H_ //----------------------------------------------------------------------------- #include <boost/asio.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/enable_shared_from_this.hpp> #include <boost/shared_ptr.hpp> #include <string> #include <vector> #include <list> #include <boost/cstdint.hpp> //----------------------------------------------------------------------------- using boost::uint32_t; using boost::uint16_t; using boost::uint8_t; using boost::int32_t; using boost::int16_t; using boost::int8_t; //----------------------------------------------------------------------------- class Hive; class Acceptor; //class Connection; //----------------------------------------------------------------------------- class Connection : public boost::enable_shared_from_this< Connection > { friend class Acceptor; friend class Hive; private: boost::shared_ptr< Hive > m_hive; boost::asio::ip::tcp::socket m_socket; boost::asio::strand m_io_strand; boost::posix_time::ptime m_last_time; std::vector< uint8_t > m_recv_buffer; std::list< int32_t > m_pending_recvs; std::list< std::vector< uint8_t > > m_pending_sends; int32_t m_receive_buffer_size; boost::asio::deadline_timer m_retryTimer ; int32_t m_retryTimerInterval; boost::asio::deadline_timer m_connectTimer; int32_t m_connectTimerInterval; boost::asio::deadline_timer m_sendTimer; int32_t m_sendTimerInterval; void DispatchSendTimer( const boost::system::error_code & error ); void HandleSendTimer( const boost::system::error_code & error ); volatile uint32_t m_error_state;,c++,eclipse,boost,C++,Eclipse,Boost,我收到的错误消息如下: ../include/TCPNetwork.h:53:9: error: invalid use of template-name ‘boost::asio::strand’ without an argument list 那么我应该如何引用m_io_strand呢?您应该编写boost::asio::io_service::strand,而不是boost::asio::strand。您还应该在类的构造函数中使用io\u服务对象初始化strand。您应该编写boost

我收到的错误消息如下:

../include/TCPNetwork.h:53:9: error: invalid use of template-name ‘boost::asio::strand’ without an argument list

那么我应该如何引用m_io_strand呢?

您应该编写
boost::asio::io_service::strand
,而不是
boost::asio::strand
。您还应该在类的构造函数中使用
io\u服务
对象初始化
strand

您应该编写
boost::asio::io\u服务::strand
,而不是
boost::asio::strand
。另外,您应该在类的构造函数中使用
io\u服务
对象初始化
strand

请提供一个。我不确定您指的是什么。我应该补充说,我更像一个灯人,C++经常落到我的膝上。所以,我正在尝试使用和理解它,但我需要一点手感,因此我的问题。我的意思是我们需要一些东西来复制粘贴和编译,没有修改,没有与问题无关的东西。这对您的读者、我们的读者和未来的读者都有好处,因为它使阅读和理解变得更容易。例如,编译非常好,显然不是您面临的问题。谢谢!我没有遇到wandbox.org,它非常有帮助。请提供一个答案。我不确定你指的是什么。我应该补充说,我更像一个灯人,C++经常落到我的膝上。所以,我正在尝试使用和理解它,但我需要一点手感,因此我的问题。我的意思是我们需要一些东西来复制粘贴和编译,没有修改,没有与问题无关的东西。这对您的读者、我们的读者和未来的读者都有好处,因为它使阅读和理解变得更容易。例如,编译非常好,显然不是您面临的问题。谢谢!我没有碰到过WangBox。ORG,非常有帮助。请原谅我的无知——我和C++有规律地工作已经20到25年了。我如何按照你所说的初始化它?原谅我的无知——我用C++工作了20到25年。如何按照您的描述初始化它?
../include/TCPNetwork.h:53:9: error: invalid use of template-name ‘boost::asio::strand’ without an argument list