cmake - 无法使用 make 构建诺基亚 HEIF 库
问题描述
我正在尝试在https://github.com/nokiatech/heif中构建 HEIF 库,但我没有运气。
我安装了 CMake 和最新版本的 MinGW。我正在按照构建库的步骤操作,但出现错误。
第一步,也就是这样:
cd heif/build
cmake --help
cmake ../srcs -G"<Generator listed by above command for your target platform>"
有效,但第二步,即:
cmake --build .
似乎正在工作,但是当它完成 41% 时,我收到此错误:
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp: In constructor 'HEIF::FileStream::FileStream(const char*)':
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp:44:9: error: 'fopen_s' was not declared in this scope
fopen_s(&m_file, filename, "rb");
^~~~~~~
C:\Users\dantelo\Documents\heif-master\srcs\reader\heifstreamfile.cpp:44:9: note: suggested alternative: 'fopen'
fopen_s(&m_file, filename, "rb");
^~~~~~~
fopen
reader\CMakeFiles\heif_static.dir\build.make:93: recipe for target 'reader/CMakeFiles/heif_static.dir/heifstreamfile.cpp.obj' failed
mingw32-make.exe[2]: *** [reader/CMakeFiles/heif_static.dir/heifstreamfile.cpp.obj] Error 1
mingw32-make.exe[2]: Leaving directory 'C:/Users/dantelo/Documents/heif-master/build'
CMakeFiles\Makefile2:233: recipe for target 'reader/CMakeFiles/heif_static.dir/all' failed
mingw32-make.exe[1]: *** [reader/CMakeFiles/heif_static.dir/all] Error 2
mingw32-make.exe[1]: Leaving directory 'C:/Users/dantelo/Documents/heif-master/build'
Makefile:85: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
我在 Windows 10 上,以防万一。我不知道为什么会这样。任何帮助表示赞赏
解决方案
它似乎fopen_s
只存在于微软提供的 C 库中,即 MSVC 中。资料来源:有没有办法将 fopen_s() 与 GCC 一起使用,或者至少创建一个关于它的#define?
您最好的选择是切换到 MSVC,因为您拥有的代码显然从未使用 MinGW 测试过,因为后者无法编译它。
或者,如果您感到幸运,您可以使用一些#define
技巧来转换fopen_s
为标准fopen
(请参阅链接问题中的答案)并希望这是代码中唯一的不兼容。
推荐阅读
- android - Flutter - 为什么我的示例 Flutter 应用程序无法运行?
- vue.js - Vuex 从 getter 访问 this.$store
- java - 忽略 Webview 中的 FileChooser 意图
- java - 超类方法和子类方法
- python - 如何从另一个单元格获取数据框单元格内容
- android-livedata - 观察者返回之前的值
- python-3.x - 带有文本和 xlsx 文件的 HttpResponse
- html - HTML5 音频 - 进度条/播放栏不适用于 OGG 音频文件/206 部分内容问题
- rubymine - 在 RubyMine 中查找项目文件不起作用
- python - Python中的函数运行两次但只使用一次,在其他问题/答案中没有找到解决方案