"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

 

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