By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,900 Members | 1,348 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,900 IT Pros & Developers. It's quick & easy.

Finding Header dependencies

P: n/a
I'm currently using MSVC.Net 2003. My task is to extract header dependencies
from C++ source code. To that end, I invoke "cl /E" and parse the
preprocessor output. While this approach is effective, it is quite slow.
The runtime of this command is so similar to actually compiling a file that
I'm guessing it really is compiled even though no output is created. Can
anyone answer a few questions about how cl performs preprocessing?

1) Are there any command line switches I should add or avoid in order to
reduce cl's work to the bare minimum required for preprocessing?

2) Would the pre-processing performance improve if I switched to VC 2005?

3) Is there some other tool or method that would give me this information in
a more efficient manner?

Thanks for your time,
Justin
Oct 16 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Justin T. Gibbs" <Justin T. Gi***@discussions.microsoft.comwrote in
message news:AB**********************************@microsof t.com...
I'm currently using MSVC.Net 2003. My task is to extract header
dependencies
from C++ source code. To that end, I invoke "cl /E" and parse the
preprocessor output. While this approach is effective, it is quite slow.
The runtime of this command is so similar to actually compiling a file
that
I'm guessing it really is compiled even though no output is created. Can
anyone answer a few questions about how cl performs preprocessing?

1) Are there any command line switches I should add or avoid in order to
reduce cl's work to the bare minimum required for preprocessing?

2) Would the pre-processing performance improve if I switched to VC 2005?

3) Is there some other tool or method that would give me this information
in
a more efficient manner?
gcc -MMD
or
makedep http://sourceforge.net/projects/makedep

>
Thanks for your time,
Justin

Oct 17 '06 #2

P: n/a
gcc -MMD
or
makedep http://sourceforge.net/projects/makedep
Yes, gcc would be much faster, but gcc doesn't have all of the built in
preprocessor definitions that cl has- definitions that may impact the headers
that are included. I could perform an analysis to on what flags are defined
for which options, and carefully pass those to gcc, but that would make my
solution much more difficult to maintain.

--
Justin
Oct 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.