Given the macro that was previously defined:
#define FILENAME somefile.h
I want to combine this with another macro line that defines the (relative) path of this file. My current approach is as follows:
#define DIRECTORY ../somedir/
#define STRINGIFY_(x) #x
#define FILE2_(dir, file) STRINGIFY_(dir ## file)
#define FILE_(dir, file) FILE2_(dir, file)
#include FILE_(DIRECTORY, FILENAME)
This results in an error (GCC4.9):
error: inserting "/" and "file" does not give a valid preprocessing token
Removing the final slash using the definition DIRECTORYeliminates this error, but obviously does not give the desired result. Similar errors occur when I try to smuggle /otherwise. For instance:
#define FILE2_(dir, file) STRINGIFY_(dir ## / ## file)
not working for the same reason.
I would like to know what is happening here, and obviously how to get around this.
. . -, , , , , ( , ).