user3016320
user3016320

Reputation: 59

Remark: unrecognized token warning for the macro concatenation

#define DATA_VAR_FILENAME(PROJECT_ID)  QUOTES(..\ ## PROJECT_ID ## _data_var.h)

or

#define DATA_VAR_FILENAME(PROJECT_ID)  QUOTES(..\##PROJECT_ID##_data_var.h)

for the above line I got below warning

remark: unrecognized token

How to eliminate the warning ?

Upvotes: 0

Views: 3367

Answers (1)

Jens Gustedt
Jens Gustedt

Reputation: 78903

From the look of it, it looks that you are trying to compose a filename in the preprocessor. This is not possible like that, since the strings that form path names are not tokens for the preprocessor.

Usually there is no need for such a manipulation. String literals are simply concatenated too larger string literals in a later compilation phase. Something like

"../" "my_file.h"

should do the trick.

You also seem to have the difficulty that on your platform \ is the path separator. So you'd have to be careful to escape it in string literals, something like "..\\"

Upvotes: 1

Related Questions