This macro is for use in #pragma
messages. It allows you to double-click on an output message and automatically open the file in the editor at the source #pragma
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#define FILE_LOC __FILE__ "(" STRING(__LINE___) ") : "
#pragma message(FILE_LOC "Your message here")
When compiling, this will generate output like:
c:\My Projects\MyFile.cpp(27) : Your message here
When you double-click on the message, MyFile.cpp
will open to line 27. Note that this is IDE-dependent; it relies on mimicking the format that Visual Studio uses for build warnings and errors. I've used it in Visual Studio 6 and 2005; your mileage may vary in other IDEs.