zjkhahah / HivisionIDPhotos-cpp

HivisionIDPhotos的cpp实现手机端部署离线部署证件照程序
31 stars 5 forks source link

windows x64 mnn 2.9 opencv 4.7.0 编译出错 #4

Open dog2code opened 3 hours ago

dog2code commented 3 hours ago

如题,使用VS2022编译出错,使用ninja也一样出错。

看了一下有许多,其中比如"memcpy": function does not take 2 arguments

这应该不是mnn和opencv库没有链接正确的结果而是函数本身的问题,是因为VS版本不对吗?

此外,最新的 release没有head ratio这个输入参数,是否这个release并非源码编译的?

谢谢

zjkhahah commented 3 hours ago

release 是之前版本的测试代码还没有加入最新编译 另外由于CMakeLists并没有屏蔽警告信息会出现一些关于内存的警告信息。这是正常的。如果出现报错可以发出截图,以进一步分析问题

dog2code commented 1 hour ago

谢谢。所以我下载了源码想自己编译看看,如果有需要可以自己改,只不过没成功。我用Ninja和VS2022都尝试编译都失败,其中的确有很多警告信息,那个其实可以忽略,但是的确有很多错误,复制粘贴如下:

D:\HivisionIDPhotos-cpp-1.1\build>ninja [1/6] Building CXX object CMakeFiles\HivisionIDphotos.dir\src\human_matting.cpp.obj FAILED: CMakeFiles/HivisionIDphotos.dir/src/human_matting.cpp.obj C:\PROGRA~2\MICROS~4\2022\BUILDT~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\cl.exe /nologo /TP -ID:\HivisionIDPhotos-cpp-1.1\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /wd4267 /wd4018 /wd4251 /wd4996 /wd4244 /wd4146 /wd4129 /wd4305 /wd4275 /wd4101 /MD /O2 /Ob2 /DNDEBUG /MT /Zi /showIncludes /FoCMakeFiles\HivisionIDphotos.dir\src\human_matting.cpp.obj /FdCMakeFiles\HivisionIDphotos.dir\ /FS -c D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp cl : Command line warning D9025 : overriding '/MD' with '/MT' D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\include\opencv2/objdetect/aruco_board.hpp(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\include\cmdline.h(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(64): error C2065: 'channels': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(102): error C2065: 'bpp': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(103): error C2065: 'size_h': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(105): error C2065: 'bpp': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(106): error C2065: 'bpp': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(107): error C2065: 'size_h': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(108): error C2065: 'size_h': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(113): error C2065: 'bpp': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(113): error C2065: 'size_h': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(117): error C2065: 'size_h': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(117): error C2065: 'bpp': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(119): error C2065: 'size_h': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(136): error C2065: 'size_h': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(136): error C2660: 'memcpy': function does not take 2 arguments C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.41.34120\include\vcruntime_string.h(43): note: see declaration of 'memcpy' D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(136): note: while trying to match the argument list '(T , void )' with [ T=float ] D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(151): error C2065: 'size_h': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(152): error C2065: 'size_h': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(152): error C2660: 'memcpy': function does not take 2 arguments C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.41.34120\include\vcruntime_string.h(43): note: see declaration of 'memcpy' D:\HivisionIDPhotos-cpp-1.1\src\human_matting.cpp(152): note: while trying to match the argument list '(void , T )' with [ T=float ] [2/6] Building CXX object CMakeFiles\HivisionIDphotos.dir\src\image_adjustment.cpp.obj FAILED: CMakeFiles/HivisionIDphotos.dir/src/image_adjustment.cpp.obj C:\PROGRA~2\MICROS~4\2022\BUILDT~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\cl.exe /nologo /TP -ID:\HivisionIDPhotos-cpp-1.1\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /wd4267 /wd4018 /wd4251 /wd4996 /wd4244 /wd4146 /wd4129 /wd4305 /wd4275 /wd4101 /MD /O2 /Ob2 /DNDEBUG /MT /Zi /showIncludes /FoCMakeFiles\HivisionIDphotos.dir\src\image_adjustment.cpp.obj /FdCMakeFiles\HivisionIDphotos.dir\ /FS -c D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp cl : Command line warning D9025 : overriding '/MD' with '/MT' D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\include\opencv2/objdetect/aruco_board.hpp(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\include\cmdline.h(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(77): error C2001: newline in constant D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(78): error C2143: syntax error: missing ')' before '}' D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(78): error C2143: syntax error: missing ';' before '}' D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(81): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(81): error C3079: an initializer list cannot be used as the right operand of this assignment operator D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(84): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(84): error C3079: an initializer list cannot be used as the right operand of this assignment operator D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(87): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(87): error C3079: an initializer list cannot be used as the right operand of this assignment operator D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(116): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(116): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(117): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(117): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(118): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(118): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(119): error C2065: 'correction': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\image_adjustment.cpp(119): error C2065: 'correction': undeclared identifier [3/6] Building CXX object CMakeFiles\HivisionIDphotos.dir\src\tool.cpp.obj FAILED: CMakeFiles/HivisionIDphotos.dir/src/tool.cpp.obj C:\PROGRA~2\MICROS~4\2022\BUILDT~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\cl.exe /nologo /TP -ID:\HivisionIDPhotos-cpp-1.1\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /wd4267 /wd4018 /wd4251 /wd4996 /wd4244 /wd4146 /wd4129 /wd4305 /wd4275 /wd4101 /MD /O2 /Ob2 /DNDEBUG /MT /Zi /showIncludes /FoCMakeFiles\HivisionIDphotos.dir\src\tool.cpp.obj /FdCMakeFiles\HivisionIDphotos.dir\ /FS -c D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp cl : Command line warning D9025 : overriding '/MD' with '/MT' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\include\opencv2/objdetect/aruco_board.hpp(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\include\cmdline.h(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(60): error C2065: 'i': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(60): error C2065: 'i': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(63): error C2065: 'layout_row_no_transpose': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(63): error C2065: 'i': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(66): error C2043: illegal break D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): error C2059: syntax error: 'for' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): error C2143: syntax error: missing ')' before ';' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): error C2143: syntax error: missing ';' before '<' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): error C2059: syntax error: '<' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): error C2059: syntax error: '++' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): error C2059: syntax error: ')' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): error C2143: syntax error: missing ';' before '{' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): error C2447: '{': missing function header (old-style formal list?) D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(79): error C2065: 'layout_row_no_transpose': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(79): error C2065: 'layout_col_no_transpose': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(82): error C2065: 'input_width': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(82): error C2065: 'i': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(82): error C2065: 'PHOTO_INTERVAL_H': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(82): error C2065: 'i': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(83): error C2059: syntax error: 'if' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(83): error C2143: syntax error: missing ';' before '{' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(83): error C2447: '{': missing function header (old-style formal list?) D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(87): error C2059: syntax error: 'else' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(87): error C2143: syntax error: missing ';' before '{' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(87): error C2447: '{': missing function header (old-style formal list?) D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(90): error C2059: syntax error: '}' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(90): error C2143: syntax error: missing ';' before '}' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(91): error C2143: syntax error: missing ')' before ';' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(91): error C2143: syntax error: missing ';' before '<' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(91): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(91): error C2086: 'int j': redefinition D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(69): note: see declaration of 'j' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(91): error C2059: syntax error: '<' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(91): error C2059: syntax error: '++' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(91): error C2059: syntax error: ')' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(92): error C2143: syntax error: missing ';' before '{' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(92): error C2447: '{': missing function header (old-style formal list?) D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(101): error C2065: 'layout_row_transpose': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(101): error C2065: 'layout_col_transpose': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(104): error C2059: syntax error: 'if' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(104): error C2143: syntax error: missing ';' before '{' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(104): error C2447: '{': missing function header (old-style formal list?) D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(107): error C2059: syntax error: 'else' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(107): error C2143: syntax error: missing ';' before '{' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(107): error C2447: '{': missing function header (old-style formal list?) D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(110): error C2059: syntax error: '}' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(110): error C2143: syntax error: missing ';' before '}' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(115): error C2143: syntax error: missing ';' before '{' D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(115): error C2447: '{': missing function header (old-style formal list?) D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(187): error C2065: 'roi': undeclared identifier D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(187): error C3861: 'white_background': identifier not found D:\HivisionIDPhotos-cpp-1.1\src\tool.cpp(194): error C2065: 'white_background': undeclared identifier [4/6] Building CXX object CMakeFiles\HivisionIDphotos.dir\src\MNN_LFFD.cpp.obj cl : Command line warning D9025 : overriding '/MD' with '/MT' D:\HivisionIDPhotos-cpp-1.1\include\opencv2/objdetect/aruco_board.hpp(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\include\cmdline.h(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss [5/6] Building CXX object CMakeFiles\HivisionIDphotos.dir\main.cpp.obj cl : Command line warning D9025 : overriding '/MD' with '/MT' D:\HivisionIDPhotos-cpp-1.1\include\opencv2/objdetect/aruco_board.hpp(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss D:\HivisionIDPhotos-cpp-1.1\include\cmdline.h(1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss ninja: build stopped: subcommand failed.

顺便提一下,Lib文件夹下面我放了自己编译出来的mnn和opencv,是静态库但不是.a结尾而是.lib,我的环境是windows。 文件如下:

MNN.lib opencv_calib3d470d.lib opencv_core470d.lib opencv_dnn470d.lib opencv_features2d470d.lib opencv_flann470d.lib opencv_gapi470d.lib opencv_highgui470d.lib opencv_imgcodecs470d.lib opencv_imgproc470d.lib opencv_ml470d.lib opencv_objdetect470d.lib opencv_photo470d.lib opencv_stitching470d.lib opencv_video470d.lib opencv_videoio470d.lib