2014-04-20 7 views
0

그래서 오늘은 특정 패키지 하나를 만들고 싶었고 항상 여기에 "컴파일 오류"가 있습니다. any1 fdwbackend.h 파일에서 수정해야 할 내용을 알려주십시오. 나는 코더가 아니지만 이것이 힘들지 않아야한다고 생각한다. 아니면? 여기 패키지 버그 필요 픽스

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__ */ 

고맙습니다 (당신은 모든 일을보고 싶다면 : https://github.com/HarpyWar/pvpgn)

+3

기준이며 생략하고,이 "충돌"아니다, 그것은 컴파일 오류입니다. –

+1

이것이 일어나는 이유를 알 수 없습니다. –

답변

1

문자열 리터럴을 기본값으로 정의 할 수 없습니다. 참조.

이 사용 일반이 C++이 아닌 C 패스에 의해 값

explicit InitError(const std::string str = "") 
     :std::runtime_error(str) {}