首先,我想将PhysX SDK中的一个Sample 独立出来。
我把所有原例子中的cpp和h文件都考到我新建的工程目录下之后,编译过了,但是连接出了问题,不知道怎么解决。错误信息如下:
Car.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: bool __thiscall std::_Tree<class std::_Tmap_traits<float,float,struct std::less<float>,class std::allocator<struct std::pair<float const ,float> >,0> >::const_iterator::operator==(class std::_Tree<class std::_Tmap_traits<float,float,struct std::less<float>,class std::allocator<struct std::pair<float const ,float> >,0> >::const_iterator const &)const " (??8const_iterator@?$_Tree@V?$_Tmap_traits@MMU?$less@M@std@@V?$allocator@U?$pair@$$CBMM@std@@@2@$0A@@std@@@std@@QBE_NABV012@@Z)
1>NxAllVehicles.obj : error LNK2001: unresolved external symbol __CrtDbgReportW
1>NxVehicle.obj : error LNK2001: unresolved external symbol __CrtDbgReportW
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)

解决方案 »

  1.   

    问题已经解决了。像这种情况,可以推测运用了错误的运行库包。在一程序中使用不同类型的运行时库或使用调试和非调试版本的运行时库,则将收到此链接错误。例如,编译一个文件以使用一种运行时库,而编译另一个文件以使用另一种运行时库(例如单线程运行时库对多线程运行时库),试图链接它们,则将得到此警告。应将所有源文件编译为使用同一运行时库。其实就是调正编译器选项参数:/MD、/MT   和   /LD在vc8中,在“配置属性-->C/C++-->代码生成-->运行时库”中将“多线程(/MT)”统一改为“多线程调试(/MTd)”即可。