gpt4 book ai didi

gcc - 去掉cpp生成的注释

转载 作者:行者123 更新时间:2023-12-04 16:12:53 25 4
gpt4 key购买 nike

我用 #include ".../frontend/tokens.mll"lexer.mll ,然后 cpp -C -P frontend/lexer.mll -o frontend/lexer_new.mll生成 lexer_new.mll .

这一直有效,直到我昨天将我的 ubuntu 从 12.04 升级到 14.04。

编译报错:

ocamllex frontend/lexer_new.mll
File "frontend/lexer_new.mll", line 1, character 1: illegal character /.
make: *** [frontend/lexer_new.ml] Error 3

那是因为在 lexer_new.mll开头插入了几行C注释:
/* Copyright (C) 1991-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
... */

我不记得在升级之前是否生成了相同的评论。

有谁知道如何摆脱这些评论?

PS:gcc 版本是: gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

最佳答案

您可以使用 cpp带旗-nostdinc并且不要使用标志 -C .

关于gcc - 去掉cpp生成的注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25314725/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com