Search code examples
c++visual-studioassemblyseh

Visual studio "module unsafe for SAFESEH image" occurring when building release in Assembly/C++


I've been following this youtube tutorial to begin learning about Assembly: https://www.youtube.com/watch?v=W3roB5sRg4o&list=PLRwVmtr-pp05c1HTBj1no6Fl6C6mlxYDG&index=2

And everything's been going fine until I switch the build from debug to release, returning two errors: "module unsafe for SAFESEH image", and "unable to generate SAFESEH image". The thing is that I've deleted everything except for the External Dependencies folder, meaning that I don't have a vast selection of properties to choose from.

Here's a screenshot to my Visual Studio environment:

A screenshot of me on visual studio going through the errors.

And here's another screenshot of my properties:

My visual studio properties

I'm a bit confused, since some other forums say to just change a setting, but since I deleted those default project folders I don't have it. Or is it something simple that I'm missing?


Solution

  • I found a comment saying to replace the old build command from ml /c /Cx /coff "%(FullPath)" to ml /c /Cx /coff /safeseh "%(FullPath)" (notice the addition of /safeseh), which resolved the issue.