How to remove lines added by default to the beginning of the C preprocessor?

I'm trying to use the C preprocessor for non-C code, and it works fine, except for creating such lines at the top:

# 1 "test.java" # 1 "<built-in>" # 1 "<command-line>" # 1 "test.java" 

The problem is that these lines are not valid in Java. Is there a way to get the preprocessor not to write this stuff? I would prefer not to run this through something else, just to delete the first 4 lines each time.

+15
c-preprocessor
Jun 01 '10 at 1:58
source share
1 answer

If you are using the gcc preprocessor:

  -P Inhibit generation of linemarkers in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code, and will be sent to a program which might be confused by the linemarkers. 

from gcc cpp man page

+22
Jun 01 '10 at 2:02
source share



All Articles