包错误需要修复
package bug need fix
所以今天我想制作一个特定的包,它总是在这里"编译错误"告诉我在fdwbackend.h文件中修复什么?我不是c程序员,但我认为这应该不难。。或
这是来自终端的日志:
mp41:build H$ make
[ 8%] Built target compat
[ 8%] Building CXX object src/common/CMakeFiles/common.dir/fdwatch.o
In file included from /Users/H/Documents/gitprojects/pvpgn/src/common/fdwatch.cpp:29:
In file included from /Users/H/Documents/gitprojects/pvpgn/src/common/fdwatch_select.h:31:
/Users/H/Documents/gitprojects/pvpgn/src/common/fdwbackend.h:36:42: error: reference to type
'const std::string'
(aka 'const basic_string<char, char_traits<char>, allocator<char> >') could not bind to
an lvalue of type 'const char [1]'
explicit InitError(const std::string& str = "")
^ ~~
/Users/H/Documents/gitprojects/pvpgn/src/common/fdwbackend.h:36:42: note: passing argument to
parameter 'str' here
1 error generated.
make[2]: *** [src/common/CMakeFiles/common.dir/fdwatch.o] Error 1
make[1]: *** [src/common/CMakeFiles/common.dir/all] Error 2
make: *** [all] Error 2
这是fdwbackend.h代码:
#ifndef __PVPGN_FDWBACKEND_INCLUDED__
#define __PVPGN_FDWBACKEND_INCLUDED__
#include <stdexcept>
namespace pvpgn
{
class FDWBackend
{
public:
class InitError :public std::runtime_error
{
public:
explicit InitError(const std::string& str = "")
:std::runtime_error(str) {}
~InitError() throw() {}
};
explicit FDWBackend(int nfds_);
virtual ~FDWBackend() throw();
virtual int add(int idx, unsigned rw) = 0;
virtual int del(int idx) = 0;
virtual int watch(long timeout_msecs) = 0;
virtual void handle() = 0;
protected:
int nfds;
};
}
#endif /* __PVPGN_FDWBACKEND_INCLUDED__ */
回复的thanx
(如果你想看看整件事:https://github.com/HarpyWar/pvpgn)
不能将字符串文字定义为引用的默认值。
省略引用,使用纯传递值
explicit InitError(const std::string str = "")
:std::runtime_error(str) {}
相关文章:
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- 编写代码时C++出现错误:错误 1 错误 C2601:'circle':本地函数定义是非法的
- Websocket++ 错误:收到错误handle_transport_init TLS 握手失败
- 为什么我使用 std::copy() 收到运行时错误(分段错误)?
- 结构数组的构造函数错误,错误消息:没有构造函数实例与参数列表匹配
- C++ 分段错误:11 错误,同时编码将两个数字相加的链接列表
- 为什么我的代码包含错误分段错误(核心转储)?
- C++ Schannel POST 400 错误代码错误请求
- 未知C++错误:致命错误:glibc检测到无效的stdio句柄
- CPPRestSdk给出错误SSL错误:WINHTTP_CALLBACK_STATUS_FLAG_INVALID_CA
- "pip install openexr"上的语法错误:错误的编译器?
- 需要找到3个小错误-内存错误
- 错误 LNK1104:错误消息中显示的路径未在其他依赖项中定义
- 编译后的内置包错误 - C++
- 尝试遵守Yolo时,我收到未找到包错误
- 如何修复 必要 QT 包错误"debug.apk"?
- 编译 gSOAP 2.8.8 软件包错误
- 无法在Windows 10 collect2.exe上使用Python27 MingGW安装leven软件包错误
- 在Visual Studio 2015中扩展lambda中的参数包:错误C3546
- 包错误需要修复