views:

111

answers:

2

How can i create a table to get compilation time of each c++ file in visual studio 2005 project.

+1  A: 

"Tools" -> "Options" -> "Projects and Solutions" -> "VC++ Project Settings"

Tick "Build Timing".

Alex B
Seriously, it's that easy? I still like my solution! :)
Greg Hewgill
A: 

It's been a while since I've used that version of the compiler, but I recall it prints the name of the file it's compiling to the console (when you use the command line build). If that's the case, then you can write a program that does the following:

  1. CreateProcess on the command line compiler, redirecting stdout to a pipe
  2. Read from the pipe, looking for source file names
  3. Each time a source file name is seen, note the current timestamp
  4. When the pipe is closed, print out the times taken for each file build

While this approach could be developed in C++, it would likely be easier to use a tool such as Perl to implement it.

Greg Hewgill
thanks greg thats a nice approach...
wat about writing a Python script??
Sure, Python would be equally suitable for this.
Greg Hewgill
could you give some lines of code to perform this????hope i m not bothering you..