2016-08-31 2 views
-1

부스트 1.49와 올바르게 컴파일되는 코드가 있습니다.부스트 스마트 어레이가 작동하지 않습니다.

error: no matching function for call to boost::shared_array::shared_array(unsigned char) Boost/boost/smart_ptr/shared_array.hpp:56: note: candidates are: boost::shared_array::shared_array() [with T = unsigned char] Boost/boost/smart_ptr/shared_array.hpp:45: note: boost::shared_array::shared_array(const boost::shared_array&)

코드 snippate이에 대한

boost::shared_array<uint8_t> val; 
constructor():val(0){} 

무엇을 할 수있는 가능한 솔루션 같다 : 지금 내가 직면하고 오류와 같은 1.61에 후원을 업그레이드?

내 현재 설정은 GCC 버전 4.1이 설치된 Linux 컴퓨터에서 수행됩니다.

+2

고대 버전의 GCC가 포함 된 어떤 리눅스 환경을 실행하고 있습니까? [4.1은 거의 10 세입니다 (2007 년 2 월 13 일)] (https://gcc.gnu.org/releases.html) – sehe

답변

2

컴파일러를 업그레이드해야합니다. 4.1은 최신 버전의 부스트에서 지원되지 않습니다. supported compilers 페이지에서

Live On Coliru

#include <boost/smart_ptr/shared_array.hpp> 

struct x { 
    boost::shared_array<uint8_t> val; 
    x() : val(0) {} 
}; 

int main() { 
    x x; 
} 

:

코드 조각은 지원 조합에 아무런 문제가 없다

Linux. GCC 4.5 and newer. Older versions may work too, but it was not tested.

그리고

The following compilers/platforms are not supported and will likely fail to compile the library:

...

  • GCC 4.2 and older.
+0

고맙습니다. @sehe. 나는 GCC 버전이 문제일지도 모른다라고 생각했다. shared_array.hpp의 특정 부분을 변경하면 여러 생성자가 단 하나의 정의 만 구현되는 것이 좋습니까? – Durgesh

관련 문제