问题
I am trying to configure Visual Studio 2010, to add a Debug configuration.
Configuration Manager->either by starting in the active solution configuration:, or Project, added New, created a New configuration, copied from Debug... (if solution, either created new configuration, or just used Debug and added new project configuration)...
http://msdn.microsoft.com/en-us/library/kwybya3w.aspx
Build -> errors that suggest a mix of Debug and Release:
defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library -> easy to fix
mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' -> don't know how to fix.
I tried to manually change the project file... But I don't know how to fix this.
What is more, I can't just fix this specific instance - there will be lots and lots of situations where this situation will happen again, so, what am I doing wrong ?
Note: I need a DEBUG configuration in order to be able to do unit testing (c++), and be able to separate building executables from unit tests.
回答1:
I can set the configuration options in a property sheet, where I can add things like
<ItemDefinitionGroup Condition="'$(Configuration)' == 'DebugCopy'">
<ClCompile>
<PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
(as well as any other options I require that may not be set by default).
It is a way to override some global settings that have been imposed on all projects I am using, which have caused the bug I had (mostly because I wasn't aware of those settings).
来源:https://stackoverflow.com/questions/12865484/visual-studio-new-debug-configuration