2017-12-09 45 views
1

"priority_queue_example.cpp"를 빌드하려고하면 내 priority_queue가 선언 된 행의 "priority_queue_example.h"를 가리키는 이러한 경고 (및 오류)가 발생합니다. 경고는 나는 이것이 무엇을 의미하는지 확실하지 않다boost :: priority_queue의 경고

mutable boost::heap::priority_queue<myObject*, boost::heap::compare<myObjectPtrCompare> > hp; 

1> priority_queue_example.cpp 
1>c:\Projects\lib\boost\boost\heap\detail\stable_heap.hpp(102): error C2220: warning treated as error - no 'object' file generated 
1>c:\Projects\lib\boost\boost\heap\detail\stable_heap.hpp(102): warning 
C4100: 'rhs' : unreferenced formal parameter 
1>   c:\Projects\lib\boost\boost\heap\detail\stable_heap.hpp(102) : while compiling class template member function 'boost::heap::detail::size_holder<false,size_t>::size_holder(const boost::heap::detail::size_holder<false,size_t> &)' 
1>   c:\Projects\lib\boost\boost\heap\detail\stable_heap.hpp(189) : see reference to function template instantiation 'boost::heap::detail::size_holder<false,size_t>::size_holder(const boost::heap::detail::size_holder<false,size_t> &)' being compiled 
1>   c:\Projects\lib\boost\boost\heap\detail\stable_heap.hpp(151) : see reference to class template instantiation 'boost::heap::detail::size_holder<false,size_t>' being compiled 
1>   c:\Projects\lib\boost\boost\heap\priority_queue.hpp(65) : see reference to class template instantiation 'boost::heap::detail::heap_base<T,myObjectPtrCompare,false,unsigned __int64,false>' being compiled 
1>   with 
1>   [ 
1>    T=myObject * 
1>   ] 
1>   c:\Projects\priority_queue_example.h(193) : see reference to class template instantiation 'boost::heap::priority_queue<myObject *,boost::heap::compare<myObjectPtrCompare>,boost::parameter::void_,boost::parameter::void_,boost::parameter::void_>' being compiledcompare<ObjectPtrCompare>,boost::parameter::void_,boost::parameter::void 

내 priority_queue 선언이다. 이 문제를 해결할 수 있습니까?

이것은 내 비교 클래스가 정의되고,

struct myObjectPtrCompare 
{ 
    bool operator()(const myObject* lhs, const myObject* rhs) const 
    { 
     return (lhs->getProp() < rhs->getProp()); 
    } 
}; 

답변

1

부스트는 경고없이하지 않습니다/W4와. 즉, 코드가 핵심이라 할지라도 위조 된 경고가있을 수 있습니다. 솔루션 탐색기에서 https://docs.microsoft.com/en-us/visualstudio/ide/how-to-suppress-compiler-warnings

  1. 당신이 경고를 억제하고자하는 프로젝트 나 소스 파일을 선택합니다

    이 문서에 지정된대로 특정 경고를 비활성화 할 수 있습니다.

  2. 메뉴 모음에서보기, 속성 페이지를 선택하십시오.

  3. 구성 속성 범주를 선택하고 C/C++ 범주를 선택한 다음 고급 페이지를 선택합니다. 사용 안 함 특정 경고 상자에서

    • 을 세미콜론으로 구분이 억제하려는 경고의 에러 코드를 지정

    • 다음 단계 중 하나를 수행합니다.

    • 특정 경고 비활성화 상자에서 편집을 선택하여 추가 옵션을 표시합니다.

  4. 확인 단추를 선택한 다음 솔루션을 다시 빌드하십시오.