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

你。 提交于 2019-12-19 12:24:58

问题


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

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

The problem is that these lines aren't valid in Java. Is there any way to get the preprocessor to not write this stuff? I'd prefer not to have to run this through something else to just remove the first 4 lines every time.


回答1:


If you're 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



来源:https://stackoverflow.com/questions/2946898/how-to-remove-lines-added-by-default-by-the-c-preprocessor-to-the-top-of-the-out

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!