1. 編譯工程設定
添加vs2019配置選項到編譯python中
cmake_generate_projects.py
def getPlatformCMakeParams(self):
outString = ' '
if self.compiler == 'vc12':
outString = outString + '-G \"Visual Studio 12 2013\"'
elif self.compiler == 'vc14':
outString = outString + '-G \"Visual Studio 14 2015\"'
elif self.compiler == 'vc15':
outString = outString + '-G \"Visual Studio 15 2017\"'
elif self.compiler == 'vc16':
outString = outString + '-G \"Visual Studio 16 2019\"'
建立檔案 PhysX-4.0.0\physx\buildtools\presets\public\vc16win64.xml
<?xml version="1.0" encoding="utf-8"?>
<preset name="vc16win64" comment="VC16 Win64 PhysX general settings">
<platform targetPlatform="win64" compiler="vc16" />
<CMakeSwitches>
<cmakeSwitch name="PX_BUILDSNIPPETS" value="True" comment="Generate the snippets" />
<cmakeSwitch name="PX_BUILDPUBLICSAMPLES" value="True" comment="Generate the samples projects" />
<cmakeSwitch name="PX_GENERATE_STATIC_LIBRARIES" value="False" comment="Generate static libraries" />
<cmakeSwitch name="NV_USE_STATIC_WINCRT" value="True" comment="Use the statically linked windows CRT" />
<cmakeSwitch name="NV_USE_DEBUG_WINCRT" value="True" comment="Use the debug version of the CRT" />
<cmakeSwitch name="PX_FLOAT_POINT_PRECISE_MATH" value="False" comment="Float point precise math" />
</CMakeSwitches>
<CMakeParams>
<cmakeParam name="CMAKE_INSTALL_PREFIX" value="install/vc16win64/PhysX" comment="Install path relative to PhysX SDK root" />
</CMakeParams>
</preset>
2. 編譯錯誤設定
錯誤1:fatal error C1083: Cannot open include file: ‘typeinfo.h’
解決:#include <typeinfo.h> 改為
#include <typeinfo>
錯誤2: error C2039: “type_info”: 不是 “std” 的成員
解決:添加檔案頭
#include <typeinfo>
錯誤3:Cannot open include file: ‘d3dx9.h’:
解決:把以下目錄添加到"C/C+±>正常-> 附加包含目錄"中
D:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
錯誤4:error C2220: 以下警告被視為錯誤
解決:"C/C+±>正常->将警告視為錯誤:否“