This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __BASENAME__?


Hi John

> Does gcc have a way to emit just the basename of __FILE__?

Sort of.

This command line:
g++ test.cpp

Results in this __FILE__
"test.cpp"

This command line:
g++ ~/dev/breitenbach/test.cpp

Results in this __FILE__
"/home/eljay/dev/breitenbach/test.cpp"

(The '~' is pre-expanded to $HOME by my shell.)

So you pretty much get what you give.

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]