我是靠谱客的博主 想人陪大炮,最近开发中收集的这篇文章主要介绍【错误记录】p7zip 交叉编译 Android 版本 NDK 报错 ( error: case value evaluates to -2 , which cannot be narrowed )一、报错信息二、解决方案,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

文章目录

  • 一、报错信息
  • 二、解决方案





一、报错信息



下载 7zip 源码 , 下载页面 https://sourceforge.net/projects/p7zip/files/ ,

解压源码 , 进入 D:develop7zipp7zip_16.02CPPANDROID7zrjni 目录 , 使用 ndk-build 编译 7z 工具 , 报如下错误 ;

[armeabi-v7a] Compile++ thumb: 7zr <= XzCrc64Reg.cpp
[armeabi-v7a] Compile++ thumb: 7zr <= ErrorMsg.cpp
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:18:10: error: case value evaluates
      to -2147467263, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_NOTIMPL             : txt = "E_NOTIMPL"; break ;
         ^
../../..Common/MyWindows.h:83:19: note: expanded from macro 'E_NOTIMPL'
#define E_NOTIMPL ((HRESULT)0x80004001L)
                  ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:19:10: error: case value evaluates
      to -2147467262, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_NOINTERFACE         : txt = "E_NOINTERFACE"; break ;
         ^
../../..Common/MyWindows.h:84:23: note: expanded from macro 'E_NOINTERFACE'
#define E_NOINTERFACE ((HRESULT)0x80004002L)
                      ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:20:10: error: case value evaluates
      to -2147467260, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_ABORT               : txt = "E_ABORT"; break ;
         ^
../../..Common/MyWindows.h:85:17: note: expanded from macro 'E_ABORT'
#define E_ABORT ((HRESULT)0x80004004L)
                ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:21:10: error: case value evaluates
      to -2147467259, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_FAIL                : txt = "E_FAIL"; break ;
         ^
../../..Common/MyWindows.h:86:16: note: expanded from macro 'E_FAIL'
#define E_FAIL ((HRESULT)0x80004005L)
               ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:22:10: error: case value evaluates
      to -2147287039, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ;
         ^
../../..Common/MyWindows.h:87:31: note: expanded from macro 'STG_E_INVALIDFUNCTION'
#define STG_E_INVALIDFUNCTION ((HRESULT)0x80030001L)
                              ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:23:10: error: case value evaluates
      to -2147024882, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_OUTOFMEMORY         : txt = "E_OUTOFMEMORY"; break ;
         ^
../../..Common/MyWindows.h:88:23: note: expanded from macro 'E_OUTOFMEMORY'
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
                      ^
D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/jni/../../../../CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates
      to -2147024809, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') [-Wc++11-narrowing]
    case E_INVALIDARG          : txt = "E_INVALIDARG"; break ;
         ^
../../..Common/MyWindows.h:89:22: note: expanded from macro 'E_INVALIDARG'
#define E_INVALIDARG ((HRESULT)0x80070057L)
                     ^
7 errors generated.
make: *** [D:/001_Programs/001_Android/002_Sdk/Sdk/ndk-bundle/build//../build/core/build-binary.mk:478: D:/develop/7zip/p7zip_16.02/CPP/ANDROID/7zr/obj/local/armeabi-v7a/objs/7zr/__/__/__/__/CPP/Windows/ErrorMsg.o] Error 1

D:develop7zipp7zip_16.02CPPANDROID7zrjni>ndk-build clean

在这里插入图片描述





二、解决方案



当前交叉编译该 p7zip 的时间是 2021 年 04 月 28 日 , 该代码最后更新时间是 2016 年 7 月 ,

在这里插入图片描述

代码比较老了 , 使用最新的 22.0.7026061 版本的 ndk , 就会报上述错误 ;

在这里插入图片描述

尝试使用旧版本的 16.1.4479499 ndk 进行编译 , 编译完成 ;

在这里插入图片描述

NDK 版本不匹配 ;

最后

以上就是想人陪大炮为你收集整理的【错误记录】p7zip 交叉编译 Android 版本 NDK 报错 ( error: case value evaluates to -2 , which cannot be narrowed )一、报错信息二、解决方案的全部内容,希望文章能够帮你解决【错误记录】p7zip 交叉编译 Android 版本 NDK 报错 ( error: case value evaluates to -2 , which cannot be narrowed )一、报错信息二、解决方案所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(37)

评论列表共有 0 条评论

立即
投稿
返回
顶部