The module is unsafe for SAFESEH C ++ image

I am using beta version of Microsoft Visual Studio 2011 Professional

I am trying to run OpenCV C ++ files ( http://opencv.willowgarage.com/wiki/Welcome ) that I compiled using cMake and Compliance for Visual Studio.

However, when I go to debug the project, I get more than 600 errors, most of which are:

error LNK2026: the module is not safe for SAFESEH image.

Apparently these files are in the opencv_ffmpeg project, but I could not find them, I looked at the Safeesception Handels SafeesEx page on the Microsoft help page, but I could not find the final answers.

I was wondering if anyone else has this problem, and if they managed to fix it.

+74
c ++ visual-c ++ visual-studio
May 15 '12 at 11:41 a.m.
source share
5 answers

From the comments:

This happens when you bundle a .obj or .lib that contains code generated by an earlier version of the compiler. This, of course, would be common if you downloaded the binary for opencv_ffmpeg instead of the source. You can disable the linker parameter, but then you will still have an incompatible version of the CRT, which may be a byte. Restore the library from the source. - Hans Passant May 15 at 13:01

Thanks for the help, it worked - Aaron Thompson May 17 at 2:50 pm

+53
Oct. 19 '12 at 18:51
source share

Disabling the option β€œImage has safe exception handlers” in the project properties β†’ Configuration properties β†’ Linker tab β†’ Advanced helped me.

+108
Nov 03 '13 at 16:36
source share

Another way is to add some SEH handler (for example, empty) to asm files and compile with the /safeseh option, and then compile another code using the /SAFESEH:YES compiler option.

Empty SEH handler:

 .safeseh SEH_handler SEH_handler proc ;handler ret SEH_handler endp 
+6
Sep 10 '14 at 16:48
source share

Your mileage may vary, but none of the above suggestions worked for me (although I did not try to run my own asm exception handler).

What was the job of choosing the release / x64 build target.

I am running Windows 10 on a 64-bit machine and using Visual Studio 2015.

The target version of Release / Win32 also works. I think the main thing is to choose "Release".

0
May 15 '17 at 18:38
source share

If you got this error while creating ZLIB in Visual Studio, this is the solution. Find contrib\masmx86\bld_ml32.bat and add /safeseh as an option

Before

 ml /coff /Zi /c /Flmatch686.lst match686.asm ml /coff /Zi /c /Flinffas32.lst inffas32.asm 

After

 ml /safeseh /coff /Zi /c /Flmatch686.lst match686.asm ml /safeseh /coff /Zi /c /Flinffas32.lst inffas32.asm 
0
Nov 27 '17 at 10:03
source share



All Articles