日期:2014-05-16  浏览次数:20581 次

mongodb 头文件包含问题
添加
#include "dbclient.h" // the mongo c++ driver   

出现如下错误:
主要原因为socket 库:tr1::bind 与 微软bind 发生冲突
解决方法:可将bind调用改为::bind

   e:\program files (x86)\microsoft visual studio 10.0\vc\include\xxresult(40) : see reference to class template instantiation 'std::tr1::_Result_type2<__formal,_Fty,_Arg0,_Arg1>' being compiled
1>          with
1>          [
1>              __formal=false,
1>              _Fty=__w64 unsigned int,
1>              _Arg0=std::tr1::_Nil &,
1>              _Arg1=std::tr1::_Nil &
1>          ]
1>          e:\program files (x86)\microsoft visual studio 10.0\vc\include\xxresult(597) : see reference to class template instantiation 'std::tr1::_Result_of2<_Fty,_Farg0,_Farg1>' being compiled
1>          with
1>          [
1>              _Fty=__w64 unsigned int,
1>              _Farg0=std::tr1::_Nil &,
1>              _Farg1=std::tr1::_Nil &
1>          ]
1>          e:\program files (x86)\microsoft visual studio 10.0\vc\include\xrefwrap(28) : see reference to class template instantiation 'std::tr1::_Result_of<_Ty>' being compiled
1>          with
1>          [
1>              _Ty=__w64 unsigned int (std::tr1::_Nil &,std::tr1::_Nil &)
1>          ]
1>          e:\program files (x86)\microsoft visual studio 10.0\vc\include\xxbind1(273) : see reference to class template instantiation 'std::tr1::result_of<_Fty>' being compiled
1>          with
1>          [
1>              _Fty=__w64 unsigned int (std::tr1::_Nil &,std::tr1::_Nil &)
1>          ]
1>          e:\program files (x86)\microsoft visual studio 10.0\vc\include\xxbind0(10) : see reference to class template instantiation 'std::tr1::_Bind2<_Callable,_Arg0,_Arg1>::_Return<_Barg0,_Barg1,_Barg2,_Barg3,_Barg4,_Barg5,_Barg6,_Barg7,_Barg8,_Barg9>' being compiled
1>          with
1>          [
1>              _Callable=std::tr1::_Callable_obj<SOCKET,false>,
1>              _Arg0=sockaddr *,
1>              _Arg1=unsigned int,
1>              _Barg0