I am getting the warning message "cl : Command line warning D9035: option 'Gm' has been deprecated and will be removed in a future release" while building my project with Visual Studio 2017 latest update 15.9.2. How to resolve this warning?
7 Answers
Try selecting <inherit from parent or project defaults>
for the Enable Minimal Rebuild
option (under C/C++
> Code Generation
). After this, the option should show No (/Gm-)
, not in bold. Make sure you do this for your project(s) (you could have several projects in the solution), and all property pages they inherit from.
I had the same problem using Visual Studio 2019, in the end the problem was in a second project I had in the same solution, that had the option set to Yes (/Gm)
.

- 4,375
- 1
- 19
- 31
-
For me, whenever I set `
` for the `Enable Minimal Rebuild` option, Visual Studio would set this to `Yes (/Gm)` for `Debug|x64`. But for `Release|x64` it would set it to `No (/Gm)` as expected. I trailed this down to `Project/PropertyGroup/UseDebugLibraries` in the .vcxproj. Deleting that node (not that that's the "correct" thing to do), makes it so the default value for `Enable Minimal Rebuild` is `No (/Gm-)`. – solstice333 Jan 08 '20 at 00:55
According to the documentation
You may safely remove this option from your projects.

- 2,073
- 5
- 34
- 51
-
Thanks for the documentation, I have Modified the "Enable Minimal Rebuild" property as per the documentation but still I am getting the same warning? – Ashish Rathi Dec 03 '18 at 06:06
-
What kind of VCXPROJ are you using? Are you using the Makefile or Visual Studio build version? – Chuck Walbourn Jan 05 '19 at 19:23
-
-
This option may be set on specific file, so check on compilation of which file warning is shown – sax Apr 11 '19 at 04:53
Project
> Properties
> Configuration Properties
> C\C++
> Code Generation
>
set the Enable Minimal Rebuild
to no
, and there is no warning.

- 617
- 1
- 7
- 18

- 91
- 3
-
3
-
1@AshishRathi: Setting it to "**bold** no" adds the option `/Gm-`. You want to delete the option altogether ("inherit from parent"), **and** there should not be a parent which has either `/Gm` or `/Gm-`. – MSalters Feb 04 '21 at 15:07
Happened for me too. Did not manage to fix it through UI. In the end I searched for "MinimalRebuild" in all project files and removed it manually - that helped

- 337
- 3
- 10
-
-
2
-
This did not work for me (Visual Studio 2017). Manually removed all "MinimalRebuild" tags in the project files, still seeing the warning. – MiloDC Sep 18 '20 at 23:55
Properties > C\C++ > Code Generation > Enable Minimal Rebuild: DELETE value - and there is no warning.

- 61
- 5
-
@Ashish: Have you made sure you've selected "All Configurations" and "All Platforms" on the project's property page, before changing the value...? – Liam Jan 18 '19 at 08:54
UI did not work for me either. In the .vcxproj file search: "MinimalRebuild" I had missed a second one under Debug|Win32

- 1
- 1
-
To expand on this, this was most likely due to not have the "all configurations" option selected from the dropdown in the project settings window. You might already know this but just mentioning it in case others are wondering why you had to go into the project file source. – Ty Deuty Dec 21 '20 at 16:31
just add this above your deprecated function
#pragma warning (disable : 4996);
example
#pragma warning (disable : 4996);
your_deprecated_function();

- 4,353
- 3
- 48
- 51