2014-01-18 6 views
2

단일 부스트 헤더 파일을 포함하여 부스트와 관련된 꿰 뚫을 수없는 컴파일 오류가 발생했습니다. 컴파일에서만이 포함 된 빈 파일 (맥 OS X 10.6.8에 GCC 4.2)을 포함한다 : 단일 부스트 posix_time.hpp 헤더 포함시 컴파일 오류

In file included from ../../../Boost Libraries/Boost_1_55_0/boost/type_traits/has_left_shift.hpp:43, 
       from ../../../Boost Libraries/Boost_1_55_0/boost/lexical_cast.hpp:165, 
       from ../../../Boost Libraries/Boost_1_55_0/boost/date_time/string_parse_tree.hpp:13, 
       from ../../../Boost Libraries/Boost_1_55_0/boost/date_time/period_parser.hpp:14, 
       from ../../../Boost Libraries/Boost_1_55_0/boost/date_time/date_facet.hpp:23, 
       from ../../../Boost Libraries/Boost_1_55_0/boost/date_time/gregorian/gregorian_io.hpp:16, 
       from ../../../Boost Libraries/Boost_1_55_0/boost/date_time/gregorian/gregorian.hpp:31, 
       from ../../../Boost Libraries/Boost_1_55_0/boost/date_time/posix_time/time_formatters.hpp:12, 
       from ../../../Boost Libraries/Boost_1_55_0/boost/date_time/posix_time/posix_time.hpp:24, 
       from /Users/homedir/dev/TheProject/Mac/Xcode/../Source/feature/test.cpp:12: 
../../../Boost Libraries/Boost_1_55_0/boost/type_traits/detail/has_binary_operator.hpp:155: error: expected unqualified-id before 'do' 
In file included from ../../../Boost Libraries/Boost_1_55_0/boost/date_time/posix_time/posix_time.hpp:34, 
       from /Users/homedir/dev/TheProject/Mac/Xcode/../Source/feature/test.cpp:12: 
../../../Boost Libraries/Boost_1_55_0/boost/date_time/posix_time/time_parsers.hpp:40: error: expected `}' at end of input 
../../../Boost Libraries/Boost_1_55_0/boost/date_time/posix_time/time_parsers.hpp:40: error: expected unqualified-id at end of input 
../../../Boost Libraries/Boost_1_55_0/boost/date_time/posix_time/time_parsers.hpp:40: error: expected `}' at end of input 
../../../Boost Libraries/Boost_1_55_0/boost/date_time/posix_time/time_parsers.hpp:40: error: expected `}' at end of input 
../../../Boost Libraries/Boost_1_55_0/boost/date_time/posix_time/time_parsers.hpp:40: error: expected `}' at end of input 

이 부스트 라이브러리

과 같이 사용되는 :

#include "boost/date_time/posix_time/posix_time.hpp" 

은 ... 이러한 오류를 발생 "헤더 만"- 작성되지 않았습니다.

실마리가 있습니까?

+0

나는 바이너리가 아닌 컴파일러 콜렉션에서 GCC를 사용한다고 가정하지만, 어떤 경우에 컴파일을 사용하고 계십니까? 'C++'또는'g ++'를 사용하고 있습니까, 아니면 문자 그대로'gcc '를 사용하고 있습니까? – Corbin

+0

XCode가 생성 중입니다 : /Developer/use/bin/gcc-4.2 -x C++ (그리고 다른 모든 옵션, 경로 등) – SMGreenfield

+0

이 라이브러리는 GCC 4.2를 좋아하지 않습니다. (매우 오래된 것입니다.) –

답변

1

문제는 파일 <AssertMacros.h>에 있는데, 어떻게 든 포함됩니다.

"boost/type_traits/detail/has_binary_operator.hpp"에서 check이라는 함수와 충돌하는 check (또 다른 이름은 require)이라는 매크로를 정의합니다.

__ASSERTMACROS__을 정의하면이 문제를 방지 할 수 있습니다.

FWIW, Mac OS X 10.7 이상에서는 Apple에서이 매크로를 __check 등으로 변경하여이 문제를 사전에 방지합니다.

+0

- 당신은 100 % 정확합니다. "어떻게 든"10.5 SDK의 CarbonCore.framework에는 AssertMacros.h가 포함 된 Debugging.h가 포함되어 있습니다. 그리고 예, __ASSERTMACROS__를 정의하면 위의 문제가 해결됩니다. 그 일을하는 다른 부작용은 무엇입니까? – SMGreenfield

+1

'__ASSERTMACROS__'를 정의하는 것은 효과적으로''가 포함되는 것을 막아줍니다. 왜냐하면 그것이 '포함 가드'로 사용되기 때문입니다. 부작용은 그 파일에 정의 된 매크로를 사용할 수 없다는 것입니다 (아마 어쨌든 사용하지 않을 것입니다). –