How to disable /Oy (Frame-Pointer Omission) in Release version in vc9 - c++

I turned off FPO manually(/Oy–) in vs2008 ,but it has no effect and my code still omits frame pointers in release version.
BTW i also turned off /GL as micosoft said there was a bug bwtween /GL and /O2 enter link description here
every thing was OK when i tried to compile the same project with vs2010, ,but i need to make it work in vs2008,does any one know how to fix this? thanks!!!

Related

Is std::any supported in MSVC 2017?

I try to compile a piece of code with:
cl /c /std:c++latest /Gm- /sdl /Zc:inline /RTC1 /Oy /MDd /FA /EHs main.cxx
but I get this error:
error C2039: 'any': is not a member of 'std'
and I wonder how (if possible) can I get to have this feature. I don't see anything about it on their sites but knowing how much time they take to update them maybe it can be done
Yes, <any> has shipped with every release of VS 2017.
It is, but one has to make sure that the correct c++ version is used.
Right click the project and under Properties->C/C++->Language->C++ Language Standard make sure it is set to the correct one.

visual studio builds with optimization flags even when disabled in options

I want to use openCV in my Qt project. But the release build crash and mixing release and debug causes bugs. So I made search and found that building openCV on my very computer setting the same flags (optimization flags) that my project may help.
So I used cmake to generate the openCV project, and open the openCV.sln in my visual studio. But even when I disable the optimization in the properties, the detailed log output shows me that there's /O2 in the cl.exe command line.
Any one get a solution? I don't know well how to use Visual Studio, maybe I can build project from command line?

How do I workaround error C1001 in visual C++ compiler?

I have just upgraded Microsoft Visual Studio Enterprise 2015 from Update 2 to Update 3 and now I am getting the following error:
fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'f:\dd\vctools\compiler\utc\src\p2\wvm\mdmiscw.c', line 2687)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information
The location is the first line which includes a header. The project has settings
/FR"x64\Debug\" /GS /W3 /Zc:wchar_t /Zi /Od /Fd"x64\Debug\vc140.pdb"
/Zc:inline /fp:precise /D "WIN32" /D "_DEBUG" /D "_WINDLL" /D
"_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /clr
[some /FU"..."] /MDd /Fa"x64\Debug\" /EHa /nologo /Fo"x64\Debug\"
/Fp"....pch"
How do I make my project build again?
C1001 basically indicates a compiler crash, i.e. you might have created valid C/C++ code that triggers a bug in the VC compiler. It would probably be a good idea to submit a bug report via https://connect.microsoft.com/VisualStudio/Feedback for further investigation by Microsoft.
I myself just ran into a C1001 while compiling OpenCV with Visual Studio Express 2015 Update 3. In my case, the C1001 error message also pointed me to the OpenCV core code line that triggers the compiler crash. After looking into the actual code semantics at that particular line, I suspected the compiler's floating point handling to be the root cause of the issue. It was dealing with a big, hard-coded double array lookup table which might have caused rounding issues. (Just in case somebody googles for this, I am listing the reference here: opencv_core, mathfuncs_core.cpp, line 1261, macro-expansion of LOGTAB_TRANSLATE).
In my case, setting the compiler's floating-point model from 'precise' to 'strict' resolved the C1001 issue. However, as you haven't included a code fragment of the lines that cause the C1001 to raise, it's difficult to say whether the above will fix your issue as well. If you want to give it a try, you can find the compiler switch in your project settings / C/C++ / Code Generation tab. Instead of Precise (/fp:precise), select Strict (/fp:strict) as Floating Point Model. This change may affect the performance of your code, but should not affect its precision. See https://msdn.microsoft.com/en-us/library/e7s85ffb.aspx for further information.
According to visual studio developers community,
this issue was fixed and closed (on July 2019) and should not appear at latest VS version. So upgrading to the latest version should solve the issue.
However, I've just now upgraded my VS to the latest version (16.7.1) and I still encounter this problem getting fatal error C1001: Internal compiler error.
An edit: See the comments below, people say the issue also appears at VS 2022 17.3.6 and at VS 2019 16.9.4
Finally, the following solution worked for me:
change the optimization option (project properties->C/C++->optimization) to 'Custom' and at (project properties->C/C++->command line') add additional options of '/Ob2, /Oi, /Os, /Oy'.
taken from: Visual studio in stuck Generating code

Missing MSVCP100.dll even with Runtime Library set to /MT

I created a program using Visual Studio 2010 and it runs fine on my computer, but on another machine it gives this error:
Now, I've done my research and I came up with at least 20 identical answers that all say the same thing: Configure your Runtime Library to /MT (or /MTd for debug) and rebuild. Great, only problem is that I already did just that and it still doesn't work...
Now, the alternative would be to force the users to install the Microsoft VS 2010 C++ Redistributable Package, but I'd very much like to avoid that. So any explanation as to why my solution is not working? Something weird worth mentioning is that my executable size doesn't seem to change even when I rebuild it with /MT, which makes no sense. Also, I'm not using any CLR support.
Thanks for your help.

module unsafe for SAFESEH image C++

I am using Microsoft Visual Studio 2011 Professional Beta
I am trying to run the OpenCV C++ files (http://opencv.willowgarage.com/wiki/Welcome) that I have compiled using cMake & the Visual Studio Complier.
However when I go to debug the project I get 600+ errors most of them being:
error LNK2026: module unsafe for SAFESEH image.
Apparently these files are in the opencv_ffmpeg project but I couldn't find them, I have had a look at the safeseh Safe Exception Handlers page on the Microsoft help page but I couldn't find any definitive answers.
I was wondering if anyone else has had this problem and if they managed to fix it.
Disabling option "Image has Safe Exception Handlers" in Project properties -> Configuration Properties -> Linker -> Advanced tab helped me.
From the comments:
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. – Hans Passant May 15 at 13:01
 
 
Thanks for the help, it worked – Aaron Thompson May 17 at 14:50
If you got this error while building ZLIB in Visual Studio here is the solution. Look for contrib\masmx86\bld_ml32.bat and add /safeseh as a 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
Other way is to add some SEH handler (empty for example) to asm files and compile them with /safeseh option, then compile other code normally with /SAFESEH:YES compiler option.
Empty SEH handler:
.safeseh SEH_handler
SEH_handler proc
;handler
ret
SEH_handler endp
Your mileage may vary, but none of the above suggestions worked for me (although I did not try rolling my own asm exception handler).
What did work was to select build target Release/x64.
I am running Windows 10 on a 64-bit machine, and using Visual Studio 2015.
The target Release/Win32 works, too. I guess the main thing is to pick "Release".