windows编译SDK

编程

基本环境:light-lpr-pro, win10、Visual Studio 2017,Visual Studio build tools,opencv 3.4.2,MNN-0.2.0.8,NCNN 、protobuf-3.4.0

..............这里只编译32位的版本,所有的项目都编译成32位版本,重要重要!!!...........

startup -> visual studio 2017 -> x86  Native command tool prompt for vs2017, 右键,run as Administrator

首先编译protobuf-3.4.0,

> cd protobuf-3.4.0

> mkdir build-win32

> cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../cmake

> nmake install

第二部,编译ncnn

> cd ncnn

> mkdir build-win32

> cd build-win32

> cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%cd%/install -DProtobuf_INCLUDE_DIR=C:Usersxinhuanprotobuf-3.4.0uild-win32/install/include -DProtobuf_LIBRARIES=C:Usersxinhuanprotobuf-3.4.0uild-win32/install/lib/libprotobuf.lib -DProtobuf_PROTOC_EXECUTABLE=C:Usersxinhuanprotobuf-3.4.0uild-win32/install/bin/protoc.exe -DNCNN_VULKAN=OFF ..

这里的tools、exe、include路径一定要写成全路径,否则链接会报错,,,,,,

编译好ncnn后,把build-win32/install/include/ncnn整个文件夹复制到light-lpr-pro/include目录下,build-win32/install/libncnn.lib复制到light-lpr-pro/lib-win32目录下

第三步;编译MNN,注释掉CMakeLists.txt文件中的COMMAND powershell ${CMAKE_CURRENT_SOURCE_DIR}/schema/generate.ps1 -lazy这行,手工执行.schemagenerate.ps1 -lazy

> cd MNN

> .schemagenerate.ps1 -lazy

> mkdir build-win32

> cd build-win32

> cmake -G "NMake Makefiles" ../ -DCMAKE_BUILD_TYPE=Release

> nmake install

编译成功后,复制C:/Program Files (x86)/MNN/lib/MNN.dll到light-lpr-pro/lib-win32/目录下,复制C:/Program Files (x86)/MNN/include/目录下所有的头文件到light-lpr-pro/thrid-pary/mnn/include目录下

第四步,编译opencv

>mkdir build-win32

> cd build-win32

> cmake -G "NMake Makefiles" -DBUILD_JAVA=OFF -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -DBUILD_opencv_face=OFF -DBUILD_opencv_legacy=OFF ../ -D BUILD_opencv_gpu=ON -D BUILD_opencv_gpucodec=On -DCMAKE_BUILD_TYPE=Release

> nmake

> nmake install

第五步编译light-lpr-pro, 

> mkdir build-win32

> cd build-win32

> cmake -G "NMake Makefiles" -DBUILD_WITH_FREETYPE=OFF -DBUILD_UTILS=OFF -DCMAKE_BUILD_TYPE=Release ../

> nmake

[ 10%] Building CXX object src/mlpdr/CMakeFiles/mlpdr.dir/MLPDR.cpp.obj
MLPDR.cpp
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8573): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8632): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8633): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8634): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8635): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9530): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9538): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9545): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9552): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9559): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9566): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9572): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9578): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9598): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9607): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9616): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9625): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9639): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9646): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9653): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9660): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9667): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9677): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9687): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(9697): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(10123): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(10124): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1377): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1387): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1403): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1415): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1441): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1449): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1462): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1561): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1569): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1583): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinuser.h(1590): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinreg.h(109): error C2872: “ACCESS_MASK”: 不明确的符号
C:Program Files (x86)Windows Kits10include10.0.14393.0umwinnt.h(8572): note: 可能是“DWORD ACCESS_MASK”
C:Usersxinhuanopencvuild-win32installincludeopencv2/core/mat.hpp(67): note: 或  “ACCESS_MASK”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(174): warning C4003: “min”宏的实参不足
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(176): warning C4003: “min”宏的实参不足
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(174): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(174): error C2612: 基/成员初始值设定项列表中的非法后缀“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(236): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(237): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(241): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(250): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(251): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(255): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(256): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(260): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(261): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(265): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(266): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(270): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(271): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(275): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(276): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(280): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(281): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(285): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(286): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(290): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(291): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(295): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(296): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(300): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(301): error C2733: “halide_type_of”: 不允许重载函数的第二个 C 链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeHalideRuntime.h(242): note: 参见“halide_type_of”的声明
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeTensor.hpp(92): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeTensor.hpp(115): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeTensor.hpp(181): error C2894: 模板不能声明为有“C”链接
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(454): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(454): error C2062: 意外的类型“unknown-type”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(454): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(455): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(455): error C2062: 意外的类型“unknown-type”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(455): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(456): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(456): error C2062: 意外的类型“unknown-type”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(456): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(457): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(457): error C2062: 意外的类型“unknown-type”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(457): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(525): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(525): error C2062: 意外的类型“unknown-type”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(525): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(526): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(526): error C2062: 意外的类型“unknown-type”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(526): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(527): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(527): error C2062: 意外的类型“unknown-type”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(527): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(528): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(528): error C2062: 意外的类型“unknown-type”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(528): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(564): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(564): error C2062: 意外的类型“unknown-type”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(564): error C2059: 语法错误:“)”
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(565): error C2589: “(”:“::”右边的非法标记
c:usersxinhuanlight-lpr-pro3rd-partymnnincludeRect.h(565): error C2059: 语法错误:“)”
C:Usersxinhuanlight-lpr-pro3rd-partyMNNincludeImageProcess.hpp(128): error C2894: 模板不能声明为有“C”链接
C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.10.25017includestack(15): error C2894: 模板不能声明为有“C”链接
C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.10.25017includestack(141): error C2894: 模板不能声明为有“C”链接
C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.10.25017includestack(141): fatal error C1003: 错误计数超过 100;正在停止编译
NMAKE : fatal error U1077: “C:PROGRA~2MICROS~32017BUILDT~1VCToolsMSVC1410~1.250inHostX86x86cl.exe”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.10.25017inHostX86x86

make.exe"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.10.25017inHostX86x86

make.exe"”: 返回代码“0x2”
Stop.

这些错误看起来莫名奇妙,经过搜索,【error C2872: “ACCESS_MASK”: 不明确的符号的】的问题是由window.h的文件里也有一个cv::ACCESS_MASK的宏定义,和opencv里的宏定义冲突了,需要去掉程序中的using namespace cv; 并且把opencv的函数加上cv这个namespace

【“min”宏的实参不足】【“max”宏的实参不足】这两个问题应该归为一类,经过搜索发现可能是有MNNdefine.h中的 定义的NOMINMAX和其他的引入的头文件有冲突引起。合理的头文件引入次序非常重要,按照系统头文件、第三方头文件、项目头文件的引入次序,经过试验,以下引入次序可以编译成功,且几百个编译错误,flatbuffer、halideruntime、mnn的编译错误全消失!这感觉比中大奖还高兴!!!,然后顺利编译通过。

#include <ctime>

#include <assert.h>

#include "mlpdr/lpr.hpp"

#include "mlpdr/MLPDR.h"

#include "mlpdr/label.hpp"

#include "mlpdr/model.h"

#include "mlpdr/model_generated.h"

#include "mlpdr/eval_counter_generated.h"

#include "mlpdr/lprd.id.h"

#include "mlpdr/lprd.mem.h"

#define NOMINMAX

#include <ncnn/net.h>

#include <ncnn/platform.h>

#include <ncnn/cpu.h>

#include <Interpreter.hpp>

#include <MNNDefine.h>

#include <Tensor.hpp>

#include <ImageProcess.hpp>

#include <flatbuffers/code_generators.h>

#include <flatbuffers/flatbuffers.h>

#include <flatbuffers/idl.h>

#include <flatbuffers/util.h>

 

 

 
LINK : fatal error LNK1181: �޷��������ļ���MNN.lib��, 出现这个错误是使用了64位的包在链接32位的object文件,替换成正确的的32位包。

以上是 windows编译SDK 的全部内容, 来源链接: utcz.com/z/510480.html

回到顶部