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

3
  • 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) Commented Sep 21, 2015 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 Commented Sep 21, 2015 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. Commented Sep 21, 2015 at 15:46

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.