2011-01-22 4 views
3

갑자기 두 프로젝트 솔루션이 컴파일되지 못했습니다. 빌드를 손상시킬 수있는 변경 작업은 기억이 없습니다. 한 프로젝트는 lib이고 다른 프로젝트는 exe입니다. lib 여전히 문제없이 컴파일하는 있지만 exe 실패합니다. 일부 부스트 파일이로드 될 때 문제를 격리했습니다. 여기에 오류 표시에 충분하다 a를 stdafx.cpp입니다 :VC++ 2008 부스트 문제 컴파일

#include "stdafx.h" 
#include <boost/thread.hpp> 

는 그리고이보고 오류입니다 :

1>Compiling... 
1>stdafx.cpp 
1>  c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdlib.h(525) : see declaration of '_ultoa' 
1>c:\libs\boost_1_44_0\boost\mpl\size_t_fwd.hpp(23) : error C2143: syntax error : missing ',' before 'constant' 
1>c:\libs\boost_1_44_0\boost\mpl\aux_\integral_wrapper.hpp(42) : error C2143: syntax error : missing ',' before 'constant' 
1>c:\libs\boost_1_44_0\boost\mpl\aux_\integral_wrapper.hpp(84) : error C2143: syntax error : missing ',' before 'constant' 
1>c:\libs\boost_1_44_0\boost\mpl\aux_\integral_wrapper.hpp(84) : error C3211: 'boost::mpl::size_t<__formal>::value' : explicit specialization is using partial specialization syntax, use template <> instead 
1>  with 
1>  [ 
1>   __formal=1135 
1>  ] 
1>  c:\libs\boost_1_44_0\boost\mpl\aux_\integral_wrapper.hpp(45) : see declaration of 'boost::mpl::size_t<__formal>::value' 
1>  with 
1>  [ 
1>   __formal=1135 
1>  ] 

내가 눈치가 나는에 포함 라인을 변경하는 경우 :

#include <boost/bind.hpp> 
#include <boost/function.hpp> 
:
#include "stdafx.h" 
#include <boost/thread/thread.hpp> 

으로 코드에 포함이 작동하지만, 나는 다른이

또한 동일한 4 개의 오류 라인을 제공합니다.

누구든지 무엇이 잘못 될 수 있는지 알 수 있습니까? 나는이 코드가 몇 달 동안 작동했음을 다시 한번 말하고 있으며 오류는 어제 나왔다.

+0

'stdafx.h'는 부스트 헤더를 포함 할 수있는 적절한 위치입니다. 공통적 인 규칙은 거의 수정되지 않은 모든 헤더를 미리 컴파일 된 헤더에 포함시키는 것입니다. 먼저 winapi 항목을 포함하고 STL을 누른 다음 boost를 누른 다음 다른 항목을 포함시킵니다. 이 문제의 탐지를 간소화 할 수 있습니다 –

답변

1

추측하기 힘들지 만 stdafx.h에서 Boost와 충돌하는 매크로가있을 수 있습니다. 즉 Boost는 변수/함수/템플릿/매크로와 같은 이름을 가진 것을 사용합니다. 매크로는 스코프에 걸쳐 있음을 기억하십시오. 빠른 확인 - 포함 순서를 변경하면 문제가 사라지나요?

+0

stdafx.h is this : – Goran

+0

감사합니다 Charlie, 당신 말이 맞았습니다. 그것은 실수로 어제 거기에 도착한 Resource.h의 정의 라인이었고 새로운 리소스 ID를 정의했습니다. #define N 1135 – Goran

+0

예, C++ include system :(이것은 windows.h 헤더와 최소/최대 매크로에서 정기적으로 발생합니다. –