C++ &引用;叮当声:错误:没有输入文件;在OSX中

C++ &引用;叮当声:错误:没有输入文件;在OSX中,c++,macos,ocamllex,C++,Macos,Ocamllex,接下来,我在我的lexer.mll中使用#include“…frontend/tokens.mll”,然后使用cpp-p frontend/lexer.mll-o frontend/gen/lexer.mll生成完整的mll文件。这个解决方案以前在Ubuntu下工作过 现在,我尝试在Mac OS 10.11.1中执行此操作,它给出了一个错误clang:error:no input files gcc-v返回 Configured with: --prefix=/Library/Developer

接下来,我在我的
lexer.mll
中使用
#include“…frontend/tokens.mll”
,然后使用
cpp-p frontend/lexer.mll-o frontend/gen/lexer.mll
生成完整的mll文件。这个解决方案以前在Ubuntu下工作过

现在,我尝试在Mac OS 10.11.1中执行此操作,它给出了一个错误
clang:error:no input files

gcc-v
返回

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
我看不出在哪里使用XCode或PCH文件。有人知道我应该如何配置环境以使
cpp
工作吗

编辑1:

cpp--version
返回

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
以及评论中的一个例子:

1-开放XCode

2-创建新的XCode项目

3-选择OSX的选项卡

4-选择应用程序

5-选择命令行工具

6-在下一个窗口中,您必须输入产品名称等


< P > 7,选择C++作为一种语言< /P> < P> 'CPP-P XXX -OYYY ',你需要它是->“回声”BLAHLABLABLA. CPP“XXX”< /P> < P>这可能是CLAN的一个bug,因为这对我来说是:

$ cpp -P xxx yyy
$ cat yyy
from zzz


因此,如果我正确理解了您要做的事情,那么您希望对一个文件运行c预处理器,以生成文本输出,该文本输出将存储在另一个文件中。我不知道为什么,但这里有一个命令可以实现这一点:

clang -x c frontend/lexer.mll -E -P -o frontend/gen/lexer.mll
这会引起叮当声;将语言设置为C(
-xC
);给你的文件;只要求预处理,没有编译或链接(
-E
);输出中没有行信息(
-P
),将其存储在frontend/gen/lexer.mll中


Xcode是一个运行clang的IDE。如果您使用的是ocaml,使用Xcode可能没有帮助,因为它不知道如何处理ocaml文件。

请运行
cpp--version
,并使用
-v
标志显示运行
cpp
的输出,以显示详细的输出。请同时显示您的
.mll
文件的内容。您没有为我们提供足够的信息进行处理。您需要显示您正在运行的确切命令,因为您显示的
cpp
命令不会生成以
clang
作为程序名的消息(至少,在我尝试时不明显,我使用的是
Apple LLVM 7.3.0版(clang-703.0.29)目标:x86_64-apple-darwin15.4.0
,这有点新,但我不认为会有什么变化)。您应该显示一些最基本的材料(每个文件一行或两行就足够了),以及您正在使用的
makefile
规则,以及
make
的输出。另外,这与Xcode或PCH文件有什么关系?看起来OSX上的
cpp
在某种程度上与
clang-E
相当,如果有错误,它会说
clang:error:
。但这不能解释你的问题。你确定你在正确的目录下运行了正确的命令吗?你确定你收到的唯一消息是没有输入文件吗?我可以按照这些步骤创建一个产品,那么我如何使用它来确保例如,
cpp-pxxx-oyyy
工作?你必须作为产品名称为ex:project.cpp选择