views:

90

answers:

3

Hi everybody,

I'm looking for a line counting tool like Project Line Counter by Oz Solomon: Project Line Counter. This add-in worked perfectly for me with VS 2005 and 2008. But, unfortunately, Oz has no time to develop it further or to adapt it to VS 2010.

Do you know some great line counting tool for C++ code that perferably (but not necessarily) meets the following requirements:

  • distinguish between commented lines, blank lines, code only lines etc.
  • possibility to restrict to certain files/folders (or even VS projects)
  • list file names
  • no cost
  • integrable in VS 2010

Thanks in advance,
Flinsch.

+1  A: 

I know this doesn't meet all of your requirements but I like cloc. It's a simple to use command line tool. Example use / output...

C:\src>cloc --no3 gstreamer
    9021 text files.
    6495 unique files.
   26138 files ignored.

http://cloc.sourceforge.net v 1.09  T=258.0 s (16.7 files/s, 5527.7 lines/s)
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
C                              1633         142010         131712         617327
C/C++ Header                   1588          50625          75916         216335
Bourne Shell                     52           6830           6060          43742
C++                              73           3937           3928          29514
XML                             262           1500           1117          26552
m4                              117           3209           2064          23008
make                            456           2335            950           8661
HTML                             37             92              8           6695
Python                           14           1437            934           4446
Teamcenter def                   27             30              0           3141
Perl                              6            396            251           2338
yacc                              2            257            114           2021
Assembly                         16            312            356           1782
Objective C                       5            277            159           1001
XSLT                             10            134             42            853
Lisp                              4             91            119            393
IDL                               2             40              0            353
lex                               2             41             11            190
CSS                               2              9              1            153
Bourne Again Shell                4             37             50            146
Tcl/Tk                            1             10             27             46
sed                               2              0              0             16
D                                 1              0              0             15
--------------------------------------------------------------------------------
SUM:                           4316         213609         223819         988728
--------------------------------------------------------------------------------
dgnorton
A: 

Maybe you can use the integrated macro __LINE__, that returns a current line in code to see how VS makes line counting.

zed91