Reputation: 357
Sorry for the confusing title, but I'm not sure of a better way to say it concisely.
Let me break it down with an example to make it clearer.
#include <Bar.h>
Inside of Bar.h, I would like to be able to have something like the following code:
#pragma message ("Included from " __INCLUDER_FILENAME__)
At compile time, the message "Included from Foo.h" would appear in the log.
Does anyone know if this is possible and, if so, how to do it?
Upvotes: 2
Views: 649
Reputation: 5222
Has a __BASE_FILE__
definition
Go to Project configuration -> C/C++ / Preprocessor. In Preprocessor definitions add:
__BASE_FILE__="%(Filename)%(Extension)"
Upvotes: 0
Reputation: 31467
There is no standard way to do that. Compiler (or rather preprocessor) extensions may exist, but that would be tool-chain specific.
Upvotes: 3