48

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?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Ashish Rathi
  • 1,418
  • 2
  • 13
  • 26

7 Answers7

48

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).

Eran Zimmerman Gonen
  • 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
13

According to the documentation

You may safely remove this option from your projects.

pritaeas
  • 2,073
  • 5
  • 34
  • 51
8

project property "Enable Minimal Rebuild" image

Project > Properties > Configuration Properties > C\C++ > Code Generation > set the Enable Minimal Rebuild to no, and there is no warning.

Badhan Sen
  • 617
  • 1
  • 7
  • 18
Sai Lee
  • 91
  • 3
  • 3
    It's not resolving my problem – Ashish Rathi Dec 13 '18 at 08:43
  • 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
6

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

Oleg Fedorov
  • 337
  • 3
  • 10
4

Properties > C\C++ > Code Generation > Enable Minimal Rebuild: DELETE value - and there is no warning.

JEX725
  • 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
0

UI did not work for me either. In the .vcxproj file search: "MinimalRebuild" I had missed a second one under Debug|Win32

ASooter
  • 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
-2

just add this above your deprecated function

#pragma warning (disable : 4996);

example

#pragma warning (disable : 4996);
your_deprecated_function(); 
user889030
  • 4,353
  • 3
  • 48
  • 51