0

Assume there are 3 files which I need to compile, a.cpp, b.cpp and c.cpp. When I compile the above 3 files using microsoft compiler, the compiler outputs the file name which it completed compiling.

ex: cl a.cpp b.cpp c.cpp

a.cpp

b.cpp

c.cpp

But GCC compiler doesnot output the filename which it completed compiling.

ex: g++ a.cpp b.cpp c.cpp

//no output is shown.

Is there any option in GCC and clang which will show the filename after the compilation of it.

Sorry for the terrible english. Also I don't need any suggestions about achieving the desired result using make files.

Thanks inadvance

  • Why do you want this? What's the point? Can't you just do `g++ a.cpp && echo a.cpp && g++ b.cpp && echo b.cpp && g++ c.cpp && echo c.cpp` ? (Or, equivalently, `for f in a.cpp b.cpp c.cpp ; do g++ $f || break ; echo $f ; done`) – Jonathan Wakely Sep 21 '15 at 15:37
  • I am using my own build system, which is cross platform. If I echo then filename will be echoed even in windows system, resulting in filename being displayed twice. Hence the necessity – Prasanna BK Sep 21 '15 at 15:41
  • 1
    What about *suppressing* the compiler outputting the file name? Then echo the file name, and all build systems do it just once. – Jens Sep 21 '15 at 15:46

1 Answers1

1

No, there is no such option. Unix tools are designed to do one thing well. Compilers compile and echo $filename echoes arguments.

As an alternative, make by default outputs the commands it executes. Use it for your build and you have many options.

Jens
  • 69,818
  • 15
  • 125
  • 179
  • As I said, I know that it can be done using make system. Just wanted to make sure none of the options are available for GCC before modifying the build system. Thanks any way – Prasanna BK Sep 21 '15 at 15:43