问题
Visual Studio error D8016: '/ZI' and '/O2' command-line options are incompatible
I'm using optimization for the first time with C++. When I 'build solution' I keep getting this error. In the property pages, I have configuration set to Release Under project/properties/c++/optimization I tried all the options except for disable. Under project/properties/c++/General I also tried all the options under 'Debug Information Format' (assume 'None' is a good choice?). I think it might have something to do with the linker settings, but still don't know what to do.
回答1:
Go to the project's property page and change the value for:
C/C++ | General | Debug Information Format
To something other than "Program Database for Edit and Continue (/ZI)"
For example, "Program Database (/Zi)" should work.
回答2:
After changing
C/C++ | General | Debug Information Format
to Program Database (/Zi)
You might need to set the solution configurations to Release.
回答3:
Verify that under Linker -> Debugging says Generate Debug Info -> No.
I had this problem as well.
来源:https://stackoverflow.com/questions/29336562/visual-studio-error-d8016-zi-and-o2-command-line-options-are-incompatible