hate-engine
hate-engine

Reputation: 2350

msvc's equivalent of gcc's __BASE_FILE__

Is there any equivalent of __BASE_FILE__ in Visual C++? I want to know name of the file currently being compiled by VC++.

Note: __FILE__ expands into current file, e.g. it may be one of #includes.


From gcc's doc:

__BASE_FILE__

This macro expands to the name of the main input file, in the form of a C string constant. This is the source file that was specified as an argument when the C compiler was invoked.

Upvotes: 9

Views: 3979

Answers (2)

Bentoy13
Bentoy13

Reputation: 4956

Thanks to John's comment, here is a workaround. If you simply put __BASE_FILE__=%(Filename), it does not make a literal string. So put it between double quotes; I also added the extension since %(Filename) does not have it.

__BASE_FILE__="%(Filename)%(Extension)"

This line must be written in the preprocessor page of the property page of the project.

Upvotes: 12

anthony sottile
anthony sottile

Reputation: 69844

Doesn't look like there is an equivalent: http://msdn.microsoft.com/en-us/library/b0084kay%28v=vs.80%29.aspx

Upvotes: 2

Related Questions