error: reference to ‘ssize_t’ is ambiguous

boost python 사용시 (ver.1.3.7)
컴파일하면 다음과 같은 에러가 발생할 수 있다.

/usr/include/bits/fcntl.h:227: error: reference to ‘ssize_t’ is ambiguous
/usr/include/sys/types.h:110: error: candidates are: typedef __ssize_t ssize_t
/usr/local/include/boost-1_37/boost/python/ssize_t.hpp:15: error:                 typedef Py_ssize_t boost::python::ssize_t
/usr/include/bits/fcntl.h:227: error: reference to ‘ssize_t’ is ambiguous
/usr/include/sys/types.h:110: error: candidates are: typedef __ssize_t ssize_t
/usr/local/include/boost-1_37/boost/python/ssize_t.hpp:15: error:                 typedef Py_ssize_t boost::python::ssize_t
/usr/include/bits/fcntl.h:227: error: ‘ssize_t’ does not name a type

이것은 sszie_t가 중복 선언되어서 나타나는 문제로 다음과 같이하면 문제를 해결할 수 있다.

vi /usr/local/include/boost-1_37/boost/python/ssize_t.hpp

 
namespace boost { namespace python {
#if PY_VERSION_HEX >= 0x02050000
typedef Py_ssize_t ssize_t;
ssize_t const ssize_t_max = PY_SSIZE_T_MAX;
ssize_t const ssize_t_min = PY_SSIZE_T_MIN;
#else
typedef int ssize_t;
ssize_t const ssize_t_max = INT_MAX;
ssize_t const ssize_t_min = INT_MIN;
#endif
 }} // namespace boost::python

typedef Py_ssize_t ssize_t; 부분을 주석처리 한다!

Tags:,

Add a Comment