qt5.11.2+vs2017环境下配置pcl1.8.1以及第三方依赖库vtk的编译

1.准备工作

我所用的开发环境是win10下的qt5.11.2配置了vs2017的编译器,根据自己所用的VS的版本去官网下载对应版本的pcl库,如下

PCL-1.8.1-AllInOne-msvc2017-win64.exe

pcl-1.8.1-pdb-msvc2017-win64.zip

另外还需要下载对应版本的vtk依赖库

vtk-v8.0.0.zip

注:上面的PCL-1.8.1-AllInOne-msvc2017-win64.exe,安装后,pcl库以及它的第三方依赖库(boost 、Eigen、FLANN、OpenNI2、Qhull、 VTK)都会安装完成,这里面的vtk不适合Qt,

所以要重新在自己的编译环境下进行编译。

2.pcl库的安装

注:网上关于pcl库的安装有很多,接下来是我进行安装时的几个注意的地方

(1)安装到这一步时,选择第二个选项。

qt5.11.2+vs2017环境下配置pcl1.8.1以及第三方依赖库vtk的编译

(2)注意此处的空格,要删掉空格,否则qt无法检测有空格的文件夹(路径可更改,不一定要安装在c盘中)

我的是安装在D盘下。

qt5.11.2+vs2017环境下配置pcl1.8.1以及第三方依赖库vtk的编译

(3)OpenNI2的安装

pcl安装过程中会弹框提示安装OpenNI2,要将OpenNI2安装到pcl1.8.1的3rdParty目录下

qt5.11.2+vs2017环境下配置pcl1.8.1以及第三方依赖库vtk的编译qt5.11.2+vs2017环境下配置pcl1.8.1以及第三方依赖库vtk的编译

注:此处安装的时候,可能会提示OpenNI2安装路径太长,这个不需要理会。

(4)最后一步安装完成,为pcl库以及依赖库添加环境变量(最好添加后,重启电脑)

pcl    FLANN  Qhull  VTK  OpenNI2 这五个库需要添加环境变量(vtk可先不添加,后面要重新编译)

3.VTK的编译(cmake)

前面我们安装的pcl库中包含了预编译的VTK库,但是预编译的VTK包并没有与qt联合编译生成QVTKWidget控件(该控件用来在qt上进行显示点云),所以需要单独编译vtk。

注:单独下载的版本必须是与pcl对应一样的版本(vtk-8.0)

(1)解压vtk包到3rdParty目录下,在vtk-8.0目录下新建build文件夹,将路径填入到cmake下,点击Add Entry,添加Name为CMAKE_DEBUG_POSTFIX,Type为STRING,Value为-gd,点击Ok。这是为了将最后生成的debug和release版本的lib区别开。

qt5.11.2+vs2017环境下配置pcl1.8.1以及第三方依赖库vtk的编译

(2)点击Configure,选择VisualStudio 15 2017 Win64,点击Finish,等待配置完成。

配置列表设置

BUILD选项:

BUILD_EXAMPLESBUILD_SHADRED_LIBSBUILD_TESTING

一般情况下把只需要勾选BUILD_SHADRED_LIBS,看个人需要进行选择,我只勾选了BUILD_SHADRED_LIBS

VTK安装目录

CMAKE_INSTALL_POSTFIX 

注:将上面pcl预编译的vtk文件夹清空,将CMAKE_INSTALL_POSTFIX 设置为被清空的vtk文件夹路径

最后勾选VTK_Group_Qt

(3)单击Configure,等待配置结束。

经过一段时间后,又会多出来一些配置选项,然后按照下面的步骤配置。
 
Qt5_DIR修改为E:\Qt\Qt5.11.2\5.11.2\msvc2017_64\lib\cmake\Qt5。
 
VKT_QT_VERSION设置为5。(版本默认的是4,如果不修改会提示版本不对应) 
 
再次点击Configure继续
 
(4)配置成功后,出现Configuring done提示。点击Generate生成工程。出现Generating done后说明生成成功,就可以点击Open ProjectVS2017将会打开VTK.sln
 
首先在VS2017中解决方案配置为Debug,在解决方案管理器里,找到ALL_BUILD,右键,点击生成。等待VS编译完成。完成后,找到INSTALL,点击鼠标右键,点击生成
 
切换解决方案配置为Release,在解决方案管理器里,找到ALL_BUILD,右键,点击生成。等待VS编译完成。完成后,找到INSTALL,点击鼠标右键,点击生成。
 
上述步骤完成后,在CMAKE_INSTALL_PREFIX设置的路径下,即为编译好的文件。
 
(5)重新为vtk添加环境变量即可
 
4.将lib库路径导入.pro文件(qt添加外部库)
 
因为lib文件较多,最好编一个小程序进行读取。
 
下面是我添加的路径,可以参考一下。
 
INCLUDEPATH += E:\qt_workplace\qt_project\pcl_tool\PCL1.8.1/include/pcl-1.8\

INCLUDEPATH += E:\qt_workplace\qt_project\pcl_tool\PCL1.8.1/include/pcl-1.8/pcl\

INCLUDEPATH += E:\qt_workplace\qt_project\pcl_tool\PCL1.8.1/3rdParty/Boost/include/boost-1_64\

INCLUDEPATH += E:\qt_workplace\qt_project\pcl_tool\PCL1.8.1/3rdParty/Eigen/eigen3\

INCLUDEPATH += E:\qt_workplace\qt_project\pcl_tool\PCL1.8.1/3rdParty/FLANN/include\

INCLUDEPATH += E:\qt_workplace\qt_project\pcl_tool\PCL1.8.1/3rdParty/FLANN/include/flann\

INCLUDEPATH += E:\qt_workplace\qt_project\pcl_tool\PCL1.8.1/3rdParty/OpenNI2/Include\

INCLUDEPATH += E:\qt_workplace\qt_project\pcl_tool\PCL1.8.1/3rdParty/Qhull/include\

INCLUDEPATH += E:\qt_workplace\qt_project\pcl_tool\PCL1.8.1/3rdParty/VTK/include/vtk-8.0\

 CONFIG(debug,debug|release){

LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/lib\
-lpcl_common_debug\
-lpcl_features_debug\
-lpcl_filters_debug\
-lpcl_io_debug\
-lpcl_io_ply_debug\
-lpcl_kdtree_debug\
-lpcl_keypoints_debug\
-lpcl_ml_debug\
-lpcl_octree_debug\
-lpcl_outofcore_debug\
-lpcl_people_debug\
-lpcl_recognition_debug\
-lpcl_registration_debug\
-lpcl_sample_consensus_debug\
-lpcl_search_debug\
-lpcl_segmentation_debug\
-lpcl_stereo_debug\
-lpcl_surface_debug\
-lpcl_tracking_debug\
-lpcl_visualization_debug\ LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/3rdParty/Boost/lib\
-llibboost_atomic-vc141-mt-gd-1_64\
-llibboost_bzip2-vc141-mt-gd-1_64\
-llibboost_chrono-vc141-mt-gd-1_64\
-llibboost_container-vc141-mt-gd-1_64\
-llibboost_context-vc141-mt-gd-1_64\
-llibboost_coroutine-vc141-mt-gd-1_64\
-llibboost_date_time-vc141-mt-gd-1_64\
-llibboost_exception-vc141-mt-gd-1_64\
-llibboost_fiber-vc141-mt-gd-1_64\
-llibboost_filesystem-vc141-mt-gd-1_64\
-llibboost_graph-vc141-mt-gd-1_64\
-llibboost_graph_parallel-vc141-mt-gd-1_64\
-llibboost_iostreams-vc141-mt-gd-1_64\
-llibboost_locale-vc141-mt-gd-1_64\
-llibboost_log-vc141-mt-gd-1_64\
-llibboost_log_setup-vc141-mt-gd-1_64\
-llibboost_math_c99-vc141-mt-gd-1_64\
-llibboost_math_c99f-vc141-mt-gd-1_64\
-llibboost_math_c99l-vc141-mt-gd-1_64\
-llibboost_math_tr1-vc141-mt-gd-1_64\
-llibboost_math_tr1f-vc141-mt-gd-1_64\
-llibboost_math_tr1l-vc141-mt-gd-1_64\
-llibboost_mpi-vc141-mt-gd-1_64\
-llibboost_numpy-vc141-mt-gd-1_64\
-llibboost_numpy3-vc141-mt-gd-1_64\
-llibboost_prg_exec_monitor-vc141-mt-gd-1_64\
-llibboost_program_options-vc141-mt-gd-1_64\
-llibboost_python-vc141-mt-gd-1_64\
-llibboost_python3-vc141-mt-gd-1_64\
-llibboost_random-vc141-mt-gd-1_64\
-llibboost_regex-vc141-mt-gd-1_64\
-llibboost_serialization-vc141-mt-gd-1_64\
-llibboost_signals-vc141-mt-gd-1_64\
-llibboost_system-vc141-mt-gd-1_64\
-llibboost_test_exec_monitor-vc141-mt-gd-1_64\
-llibboost_thread-vc141-mt-gd-1_64\
-llibboost_timer-vc141-mt-gd-1_64\
-llibboost_type_erasure-vc141-mt-gd-1_64\
-llibboost_unit_test_framework-vc141-mt-gd-1_64\
-llibboost_wave-vc141-mt-gd-1_64\
-llibboost_wserialization-vc141-mt-gd-1_64\
-llibboost_zlib-vc141-mt-gd-1_64\ LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/3rdParty/FLANN/lib\
-lflann-gd\
-lflann_cpp-gd\
-lflann_cpp_s-gd\
-lflann_s-gd\ LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/3rdParty/OpenNI2/Lib\
-lOpenNI2\ LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/3rdParty/Qhull/lib\
-lqhull_d\
-lqhull_p_d\
-lqhull_r_d\
-lqhullcpp_d\
-lqhullstatic_d\
-lqhullstatic_r_d\ LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/3rdParty/VTK/lib\
-lvtkChartsCore-8.0-gd\
-lvtkCommonColor-8.0-gd\
-lvtkCommonComputationalGeometry-8.0-gd\
-lvtkCommonCore-8.0-gd\
-lvtkCommonDataModel-8.0-gd\
-lvtkCommonExecutionModel-8.0-gd\
-lvtkCommonMath-8.0-gd\
-lvtkCommonMisc-8.0-gd\
-lvtkCommonSystem-8.0-gd\
-lvtkCommonTransforms-8.0-gd\
-lvtkDICOMParser-8.0-gd\
-lvtkDomainsChemistry-8.0-gd\
-lvtkDomainsChemistryOpenGL2-8.0-gd\
-lvtkFiltersAMR-8.0-gd\
-lvtkFiltersCore-8.0-gd\
-lvtkFiltersExtraction-8.0-gd\
-lvtkFiltersFlowPaths-8.0-gd\
-lvtkFiltersGeneral-8.0-gd\
-lvtkFiltersGeneric-8.0-gd\
-lvtkFiltersGeometry-8.0-gd\
-lvtkFiltersHybrid-8.0-gd\
-lvtkFiltersHyperTree-8.0-gd\
-lvtkFiltersImaging-8.0-gd\
-lvtkFiltersModeling-8.0-gd\
-lvtkFiltersParallel-8.0-gd\
-lvtkFiltersParallelImaging-8.0-gd\
-lvtkFiltersPoints-8.0-gd\
-lvtkFiltersProgrammable-8.0-gd\
-lvtkFiltersSMP-8.0-gd\
-lvtkFiltersSelection-8.0-gd\
-lvtkFiltersSources-8.0-gd\
-lvtkFiltersStatistics-8.0-gd\
-lvtkFiltersTexture-8.0-gd\
-lvtkFiltersTopology-8.0-gd\
-lvtkFiltersVerdict-8.0-gd\
-lvtkGUISupportQt-8.0-gd\
-lvtkGUISupportQtSQL-8.0-gd\
-lvtkGeovisCore-8.0-gd\
-lvtkIOAMR-8.0-gd\
-lvtkIOCore-8.0-gd\
-lvtkIOEnSight-8.0-gd\
-lvtkIOExodus-8.0-gd\
-lvtkIOExport-8.0-gd\
-lvtkIOExportOpenGL2-8.0-gd\
-lvtkIOGeometry-8.0-gd\
-lvtkIOImage-8.0-gd\
-lvtkIOImport-8.0-gd\
-lvtkIOInfovis-8.0-gd\
-lvtkIOLSDyna-8.0-gd\
-lvtkIOLegacy-8.0-gd\
-lvtkIOMINC-8.0-gd\
-lvtkIOMovie-8.0-gd\
-lvtkIONetCDF-8.0-gd\
-lvtkIOPLY-8.0-gd\
-lvtkIOParallel-8.0-gd\
-lvtkIOParallelXML-8.0-gd\
-lvtkIOSQL-8.0-gd\
-lvtkIOTecplotTable-8.0-gd\
-lvtkIOVideo-8.0-gd\
-lvtkIOXML-8.0-gd\
-lvtkIOXMLParser-8.0-gd\
-lvtkImagingColor-8.0-gd\
-lvtkImagingCore-8.0-gd\
-lvtkImagingFourier-8.0-gd\
-lvtkImagingGeneral-8.0-gd\
-lvtkImagingHybrid-8.0-gd\
-lvtkImagingMath-8.0-gd\
-lvtkImagingMorphological-8.0-gd\
-lvtkImagingSources-8.0-gd\
-lvtkImagingStatistics-8.0-gd\
-lvtkImagingStencil-8.0-gd\
-lvtkInfovisCore-8.0-gd\
-lvtkInfovisLayout-8.0-gd\
-lvtkInteractionImage-8.0-gd\
-lvtkInteractionStyle-8.0-gd\
-lvtkInteractionWidgets-8.0-gd\
-lvtkNetCDF-8.0-gd\
-lvtkParallelCore-8.0-gd\
-lvtkRenderingAnnotation-8.0-gd\
-lvtkRenderingContext2D-8.0-gd\
-lvtkRenderingContextOpenGL2-8.0-gd\
-lvtkRenderingCore-8.0-gd\
-lvtkRenderingFreeType-8.0-gd\
-lvtkRenderingGL2PSOpenGL2-8.0-gd\
-lvtkRenderingImage-8.0-gd\
-lvtkRenderingLOD-8.0-gd\
-lvtkRenderingLabel-8.0-gd\
-lvtkRenderingOpenGL2-8.0-gd\
-lvtkRenderingQt-8.0-gd\
-lvtkRenderingVolume-8.0-gd\
-lvtkRenderingVolumeOpenGL2-8.0-gd\
-lvtkViewsContext2D-8.0-gd\
-lvtkViewsCore-8.0-gd\
-lvtkViewsInfovis-8.0-gd\
-lvtkViewsQt-8.0-gd\
-lvtkalglib-8.0-gd\
-lvtkexoIIc-8.0-gd\
-lvtkexpat-8.0-gd\
-lvtkfreetype-8.0-gd\
-lvtkgl2ps-8.0-gd\
-lvtkglew-8.0-gd\
-lvtkhdf5-8.0-gd\
-lvtkhdf5_hl-8.0-gd\
-lvtkjpeg-8.0-gd\
-lvtkjsoncpp-8.0-gd\
-lvtklibharu-8.0-gd\
-lvtklibxml2-8.0-gd\
-lvtklz4-8.0-gd\
-lvtkmetaio-8.0-gd\
-lvtknetcdf_c++-gd\
-lvtkoggtheora-8.0-gd\
-lvtkpng-8.0-gd\
-lvtkproj4-8.0-gd\
-lvtksqlite-8.0-gd\
-lvtksys-8.0-gd\
-lvtktiff-8.0-gd\
-lvtkverdict-8.0-gd\
-lvtkzlib-8.0-gd\ } else { LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/lib\
-lpcl_common_release\
-lpcl_features_release\
-lpcl_filters_release\
-lpcl_io_ply_release\
-lpcl_io_release\
-lpcl_kdtree_release\
-lpcl_keypoints_release\
-lpcl_ml_release\
-lpcl_octree_release\
-lpcl_outofcore_release\
-lpcl_people_release\
-lpcl_recognition_release\
-lpcl_registration_release\
-lpcl_sample_consensus_release\
-lpcl_search_release\
-lpcl_segmentation_release\
-lpcl_stereo_release\
-lpcl_surface_release\
-lpcl_tracking_release\
-lpcl_visualization_release\ LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/3rdParty/Boost/lib\
-llibboost_atomic-vc141-mt-1_64\
-llibboost_bzip2-vc141-mt-1_64\
-llibboost_chrono-vc141-mt-1_64\
-llibboost_container-vc141-mt-1_64\
-llibboost_context-vc141-mt-1_64\
-llibboost_coroutine-vc141-mt-1_64\
-llibboost_date_time-vc141-mt-1_64\
-llibboost_exception-vc141-mt-1_64\
-llibboost_fiber-vc141-mt-1_64\
-llibboost_filesystem-vc141-mt-1_64\
-llibboost_graph-vc141-mt-1_64\
-llibboost_graph_parallel-vc141-mt-1_64\
-llibboost_iostreams-vc141-mt-1_64\
-llibboost_locale-vc141-mt-1_64\
-llibboost_log-vc141-mt-1_64\
-llibboost_log_setup-vc141-mt-1_64\
-llibboost_math_c99-vc141-mt-1_64\
-llibboost_math_c99f-vc141-mt-1_64\
-llibboost_math_c99l-vc141-mt-1_64\
-llibboost_math_tr1-vc141-mt-1_64\
-llibboost_math_tr1f-vc141-mt-1_64\
-llibboost_math_tr1l-vc141-mt-1_64\
-llibboost_mpi-vc141-mt-1_64\
-llibboost_numpy-vc141-mt-1_64\
-llibboost_numpy3-vc141-mt-1_64\
-llibboost_prg_exec_monitor-vc141-mt-1_64\
-llibboost_program_options-vc141-mt-1_64\
-llibboost_python-vc141-mt-1_64\
-llibboost_python3-vc141-mt-1_64\
-llibboost_random-vc141-mt-1_64\
-llibboost_regex-vc141-mt-1_64\
-llibboost_serialization-vc141-mt-1_64\
-llibboost_signals-vc141-mt-1_64\
-llibboost_system-vc141-mt-1_64\
-llibboost_test_exec_monitor-vc141-mt-1_64\
-llibboost_thread-vc141-mt-1_64\
-llibboost_timer-vc141-mt-1_64\
-llibboost_type_erasure-vc141-mt-1_64\
-llibboost_unit_test_framework-vc141-mt-1_64\
-llibboost_wave-vc141-mt-1_64\
-llibboost_wserialization-vc141-mt-1_64\
-llibboost_zlib-vc141-mt-1_64\ LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/3rdParty/FLANN/lib\
-lflann\
-lflann_cpp\
-lflann_cpp_s\
-lflann_s\
-lOpenNI2\ LIBS += -LE:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/3rdParty/Qhull/lib\
-lqhull\
-lqhull_p\
-lqhull_r\
-lqhullcpp\
-lqhullstatic\
-lqhullstatic_r\ LIBS += -E:/qt_workplace/qt_project/pcl_tool/PCL1.8.1/3rdParty/VTK/lib\
-lvtkChartsCore-8.0\
-lvtkCommonColor-8.0\
-lvtkCommonComputationalGeometry-8.0\
-lvtkCommonCore-8.0\
-lvtkCommonDataModel-8.0\
-lvtkCommonExecutionModel-8.0\
-lvtkCommonMath-8.0\
-lvtkCommonMisc-8.0\
-lvtkCommonSystem-8.0\
-lvtkCommonTransforms-8.0\
-lvtkDICOMParser-8.0\
-lvtkDomainsChemistry-8.0\
-lvtkDomainsChemistryOpenGL2-8.0\
-lvtkFiltersAMR-8.0\
-lvtkFiltersCore-8.0\
-lvtkFiltersExtraction-8.0\
-lvtkFiltersFlowPaths-8.0\
-lvtkFiltersGeneral-8.0\
-lvtkFiltersGeneric-8.0\
-lvtkFiltersGeometry-8.0\
-lvtkFiltersHybrid-8.0\
-lvtkFiltersHyperTree-8.0\
-lvtkFiltersImaging-8.0\
-lvtkFiltersModeling-8.0\
-lvtkFiltersParallel-8.0\
-lvtkFiltersParallelImaging-8.0\
-lvtkFiltersPoints-8.0\
-lvtkFiltersProgrammable-8.0\
-lvtkFiltersSMP-8.0\
-lvtkFiltersSelection-8.0\
-lvtkFiltersSources-8.0\
-lvtkFiltersStatistics-8.0\
-lvtkFiltersTexture-8.0\
-lvtkFiltersTopology-8.0\
-lvtkFiltersVerdict-8.0\
-lvtkGUISupportQt-8.0\
-lvtkGUISupportQtSQL-8.0\
-lvtkGeovisCore-8.0\
-lvtkIOAMR-8.0\
-lvtkIOCore-8.0\
-lvtkIOEnSight-8.0\
-lvtkIOExodus-8.0\
-lvtkIOExport-8.0\
-lvtkIOExportOpenGL2-8.0\
-lvtkIOGeometry-8.0\
-lvtkIOImage-8.0\
-lvtkIOImport-8.0\
-lvtkIOInfovis-8.0\
-lvtkIOLSDyna-8.0\
-lvtkIOLegacy-8.0\
-lvtkIOMINC-8.0\
-lvtkIOMovie-8.0\
-lvtkIONetCDF-8.0\
-lvtkIOPLY-8.0\
-lvtkIOParallel-8.0\
-lvtkIOParallelXML-8.0\
-lvtkIOSQL-8.0\
-lvtkIOTecplotTable-8.0\
-lvtkIOVideo-8.0\
-lvtkIOXML-8.0\
-lvtkIOXMLParser-8.0\
-lvtkImagingColor-8.0\
-lvtkImagingCore-8.0\
-lvtkImagingFourier-8.0\
-lvtkImagingGeneral-8.0\
-lvtkImagingHybrid-8.0\
-lvtkImagingMath-8.0\
-lvtkImagingMorphological-8.0\
-lvtkImagingSources-8.0\
-lvtkImagingStatistics-8.0\
-lvtkImagingStencil-8.0\
-lvtkInfovisCore-8.0\
-lvtkInfovisLayout-8.0\
-lvtkInteractionImage-8.0\
-lvtkInteractionStyle-8.0\
-lvtkInteractionWidgets-8.0\
-lvtkNetCDF-8.0\
-lvtkParallelCore-8.0\
-lvtkRenderingAnnotation-8.0\
-lvtkRenderingContext2D-8.0\
-lvtkRenderingContextOpenGL2-8.0\
-lvtkRenderingCore-8.0\
-lvtkRenderingFreeType-8.0\
-lvtkRenderingGL2PSOpenGL2-8.0\
-lvtkRenderingImage-8.0\
-lvtkRenderingLOD-8.0\
-lvtkRenderingLabel-8.0\
-lvtkRenderingOpenGL2-8.0\
-lvtkRenderingQt-8.0\
-lvtkRenderingVolume-8.0\
-lvtkRenderingVolumeOpenGL2-8.0\
-lvtkViewsContext2D-8.0\
-lvtkViewsCore-8.0\
-lvtkViewsInfovis-8.0\
-lvtkViewsQt-8.0\
-lvtkalglib-8.0\
-lvtkexoIIc-8.0\
-lvtkexpat-8.0\
-lvtkfreetype-8.0\
-lvtkgl2ps-8.0\
-lvtkglew-8.0\
-lvtkhdf5-8.0\
-lvtkhdf5_hl-8.0\
-lvtkjpeg-8.0\
-lvtkjsoncpp-8.0\
-lvtklibharu-8.0\
-lvtklibxml2-8.0\
-lvtklz4-8.0\
-lvtkmetaio-8.0\
-lvtknetcdf_c++\
-lvtkoggtheora-8.0\
-lvtkpng-8.0\
-lvtkproj4-8.0\
-lvtksqlite-8.0\
-lvtksys-8.0\
-lvtktiff-8.0\
-lvtkverdict-8.0\
-lvtkzlib-8.0\ }

  

 
 
 
 
上一篇:vs2017编译并配置libcurl入门教程


下一篇:B - ACboy needs your help(动态规划,分组背包)