gpt4 book ai didi

c++ - OS X 中的 "Clang: error: no input files"

转载 作者:行者123 更新时间:2023-11-28 05:44:29 24 4
gpt4 key购买 nike

正在关注 this solution ,我在我的 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

我看不到我在哪里使用 XCode 或 PCH 文件。有谁知道我应该如何配置环境以使 cpp 工作?

编辑 1:

cpp --version 返回

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

评论中的一个例子:

enter image description here

最佳答案

因此,如果我正确理解了您要尝试执行的操作,您希望在一个文件上运行 c 预处理器以生成将存储在另一个文件中的文本输出。我不知道为什么,但是,这是一个可以完成该操作的命令:

clang -x c frontend/lexer.mll -E -P -o frontend/gen/lexer.mll

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

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

关于c++ - OS X 中的 "Clang: error: no input files",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36482291/

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