如何删除C预处理程序默认添加到输出顶部的行? [英] How to remove lines added by default by the C preprocessor to the top of the output?

查看:46
本文介绍了如何删除C预处理程序默认添加到输出顶部的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在非C代码上使用 C 预处理器,除了在顶部创建如下这样的行之外,它工作正常:

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"

问题是这些行无效在Java中。有什么方法可以使预处理器不写这些东西?我希望不必每次都删除前4行。

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.

推荐答案

正在使用gcc预处理器:

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.


来自gcc cpp手册页

from gcc cpp man page

这篇关于如何删除C预处理程序默认添加到输出顶部的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆