Error lnk2026: module unsafe for safeseh image

女生的网名这么多〃 提交于 2019-12-18 11:41:03

问题


I got this error when building a sample visual C++ project. First I downloaded 3 sample projects, all solve the same problem, print out all the prime numbers less than N (you may know these sample projects ?). I built the pure-C project without any problem. But when I tried to build the assembly-based project one, I got this error.

Thank you.


回答1:


Try to disable SAFESEH.

From spec: /SAFESEH was specified, but a module was not compatible with the safe exception handling feature.




回答2:


In Visual Studio 2012 Express Edition:

Right-click on your project ->
Properties -> 
Configuration Properties ->
Linker ->
Advanced and changed "Image Has Safe Exception Handlers" to "No (/SAFESEH:NO)"



回答3:


A picture is worth 0x3e8 words for the /SAFESEH:NO linker setting:

Or you can tell MASM to provide a guarantee that the object contains no exception handlers or that any exception handlers are defined with .SAFESEH, if you know that to be correct for your assembly code:

This will allow you to keep /SAFESEH enabled for the project's linking. But is it correct? You are making the guarantee! Be sure or use the first option.



来源:https://stackoverflow.com/questions/14710577/error-lnk2026-module-unsafe-for-safeseh-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!