I'm trying to use the C preprocessor for some text mangling. It seems to be actively trying to thwart me, however.
For test purposes, I have Test.xml.pre
:
<document>
<meta>This is a test.</meta>
SETTINGS
<output format="FORMAT" mode="MODE"/>
</document>
and then I have Setup.cpp
:
#define FORMAT fmt
#define MODE XL
#define SETTINGS <settings><!-- None yet --></settings>
I was hoping that I could somehow run the preprocessor and end up with well-formed output. I saw this question, which makes it look quite easy to use the preprocessor. But when I do this:
cpp -E -include Setup.cpp Test.xml.pre -o Test.xml
then I get this:
# 1 "Test.xml.pre"
# 1 "<command-line>"
# 1 "./Setup.cpp" 1
# 1 "<command-line>" 2
# 1 "Test.xml.pre"
<document>
<meta>This is a test.</meta>
<settings><!-- None yet --></settings>
<output format="FORMAT" mode="MODE"/>
</document>
Try as I might, I cannot get rid of the hash lines at the top. I'm also not sure why FORMAT
and MODE
as not expanding. (SETTINGS
seems to expand just fine.)
What am I doing wrong??
PS. In case it matters,
cpp (SUSE Linux) 4.8.1 20130909 [gcc-4_8-branch revision 202388]