"LNK2026 模块对于 SAFESEH 映像是不安全的"原因以及解决方法

今天在编译一个程序时,出现了“LNK2026 模块对于 SAFESEH 映像是不安全的”的错误,stackoverflow上解释原因如下:

This happens when you link an .obj or .lib that contains code created by an earlier version of the compiler. Which of course would be common if you downloaded a binary for opencv_ffmpeg instead of the source. You can turn the linker option off but then you'll still have a CRT version incompatibility that can byte. Rebuild the library from source.

It can also be caused by, as the error states, modules for which the linker can't find safe exception handlers. Assembly language modules in particular

就是说你链接了一个使用较早版本编译器生成的.lib或者.obj文件,或者找不到“safe exception handlers”,才会报这个错误。

解决方法如下:项目->项目属性->链接器->命令行,在右侧其他选项中添加“/SAFESEH:NO”,这样就不会再报错了。

有关更多SAFESEH的信息可以看这里

 

参考链接:

https://stackoverflow.com/questions/10599940/module-unsafe-for-safeseh-image-c

https://www.cnblogs.com/hanxi/archive/2012/06/10/2544230.html

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章