views:

298

answers:

3

how to find unused functions in a c++ project vc2008

A: 

You should be able to use link.exe with /map and /mapinfo to generate a map file that tells you which functions aren't called.

jeffamaphone
+1  A: 

Select "Run code Analysis on 'your project name'" from the Analyze/Build menu (according to your VS edition), VS will show a warning if there is an unused functions.

Moayad Mardini
I dont find those options in my version of VS2008 (I dont have Team System)
yesraaj
+3  A: 

I always use "/OPT:REF" when creating release versions. This flag removes all unreferenced functions and will reduce the final binary substantially if there are many functions not being used (in our case we have a kernel with loads of methods used differently from different customized applications).

The "/VERBOSE" will send information about the linking session to the output window, or to stdout if you are linking on the command line. In the latter you can always redirect this to a file.

Using both flags together will make the output contain all eliminated functions and/or data that is never referenced.

Cheers!

Magnus Skog
yours works ..just now tried..I forgot to revisit this post after trying out 2 other answers below....Thanks
yesraaj
Take +10 +15 for reminding me
yesraaj
I thank thee :)
Magnus Skog