我正在尝试用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我用的是Windows10,以防万一。我不知道为什么会发生这种事。感谢您的任何帮助
发布于 2020-01-21 19:31:49
fopen_s似乎只存在于微软提供的C库中,即在MSVC中。来源:Is there a way to use fopen_s() with GCC or at least create a #define about it?
你最好的选择就是切换到MSVC,因为你的代码显然从来没有用MinGW测试过,因为它不能被后者编译。
或者,如果你觉得幸运,你可以使用一些#define技巧将fopen_s转换成标准的fopen (参见链接问题中的答案),并希望这是代码中唯一的不兼容。
https://stackoverflow.com/questions/59838467
复制相似问题