0

I am building cpp files using msys Make.exe , and getting the below warning c:\ankit_cc\wm2015git\wm-cpp\base\wmautomator\base\wmautomator.cpp(1047) : warning C4715: 'WMAutomator::fetchSerialNumbersBasedOnLpn' : not all control paths return a value ;

I want to make this above warning to error . Please suggest .

  • Look into http://stackoverflow.com/questions/2520853/warning-as-error-how-to-rid-these – RedX Aug 08 '14 at 14:52
  • But, I have lot of C++ files , so in each file i have to add ,I want to add thia at compiler level , I mean somewhere in msys or generic makefile like Makefile.nt5 – Ankit Dixit Aug 08 '14 at 14:55
  • Find out which compiler switch that option in Visual Studio enables and use that in your makefile for all compiler invocations.... – RedX Aug 08 '14 at 14:57
  • @RedX I am using Make utility of msys , so we can't change it from VS. – Ankit Dixit Aug 08 '14 at 14:58

2 Answers2

1

Two ways of doing this

  • #pragma warning (error : 4715)

http://msdn.microsoft.com/en-us/library/2c8f766e.aspx

  • Compiling with /we4715 option passed to cl.exe

http://msdn.microsoft.com/en-us/library/thxezb7y.aspx

user93353
  • 13,733
  • 8
  • 60
  • 122
  • This I got earlier from http://stackoverflow.com/questions/4750880/can-i-treat-a-specific-warning-as-an-error But My question is to how to do the same in Makefile , because we can't add pragma in Makefile – Ankit Dixit Aug 08 '14 at 15:09
  • @AnkitDixit - see the 2nd way I added to the answer /we4715 passed to cl.exe – user93353 Aug 08 '14 at 15:11
0

Pass

/we4715

to the compiler in your makefile.

molbdnilo
  • 64,751
  • 3
  • 43
  • 82