tags:

views:

120

answers:

3

Hi,

I am trying to find all the unused methods of my project. I have search ways of doing this, but the most convincing answer I found was to declare all my functions as obsolete, and remove this attribute until I got no warnings.

The problem is that I don't know how to declare a function as obsolete. When I write:

   [Obsolete]
   class Vector3{

   };

VS2005 tells me that Obsolete does not exist. Any suggestions?

+2  A: 

I don't know the rest of your source code, but you should have a

using System;

at the top.

Jappie
Try `[System.ObsoleteAttribute]` to see if that fixes it.
Kristopher Johnson
Now it says the System doesn't exist.
Sara
That's C#. The OP is using C++.
Default
Ah sorry, overlooked the c++ tag.
Jappie
+6  A: 

In gcc you use __attribute__ ((deprecated)) to tag functions as deprecated.

It looks like __declspec(deprecated) may do the trick in VS. You'll also have to enable warning level 1 for it to result in a diagnostic.

See http://msdn.microsoft.com/en-us/library/044swk7y%28VS.80%29.aspx

Mark B
Great!! that did the trick.
Sara
Easiest way is to add a single `#if defined(_MSCVER) #define DEPRECATED __declspec(deprecated) #elif defined(__GNUC__) #define DEPRECATED __attribute__ ((deprecated)) #endif`, so you can then write `DEPRECATED class Vector3`.
MSalters
A: 

Adding __declspec(deprecated) before the function declaration did the trick.

Thank you Mark B.

Sara
Accept his answer then!
Goz