将 Clang -fsyntax-only 模式与静态库一起使用?
我正在使用 libclang 库来构建自动完成功能。 libclang 在内部自动设置 -fsyntax-only 标志。 libclang 似乎需要整个源代码树才能工作(或 .pch 文件)。我想要的只是传递单个源文件和包含它所依赖的所有代码的预编译库(.a 或 .so)?
我不知道该怎么做。
I am using libclang library to build autocomplete feature. libclang automatically -fsyntax-only flag internally. libclang seems to require entire source code tree available in order to work (or .pch files). What I want is to just pass single source file and a precompiled library (.a or .so) containing all the code it depends on?
I am unable to figure out how to do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用 -fsyntax-only ,您将要求 clang 仅检查源文件及其包含的文件的内容。它甚至不生成目标文件,更不用说 require 和库(静态或共享)。
您至少需要相关源文件及其包含的所有头文件(或这些文件的预编译版本)。您至少需要包含的库中的头文件,不需要完整的源代码树。头文件的打包方式通常取决于您使用的库。您经常会得到“标头+库”发行版。
If you use
-fsyntax-only
you are asking clang to only examine the contents of the source file and the files which it includes. It doesn't even generate an object file, let alone require and libraries (static or shared).You'll need at least the source file in question and all the header files that it includes (or a pre-compiled version of these). You will need at least the header files from the libraries that you include, you won't need a full source tree. How the headerfiles are usually packaged depends on the libraries that you are using. Frequently you get a "headers + libraries" distribution.