Sphinx 是否已经适用于 C++ 文档?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12933900/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 16:47:18  来源:igfitidea点击:

Is Sphinx already suitable for C++ documentation?

c++python-sphinxdoxygendocumentation-generation

提问by clstaudt

I want to try out documentation generators for a new project in C++. I think my options are either Doxygen or Sphinx. Since I have projects in Python for which I'd like to use Sphinx, I wonder whether Sphinx is the right choice for C++ as well. The Sphinxwebsite states that C++ is supported, but I could not find a document to get me started with C++ documentation.

我想在 C++ 中为一个新项目尝试文档生成器。我认为我的选择是 Doxygen 或 Sphinx。由于我有 Python 项目,我想使用 Sphinx,我想知道 Sphinx 是否也是 C++ 的正确选择。该狮身人面像的网站指出,支持C ++,但我无法找到一个文件让我开始用C ++文档。

A similar question has already been discussed on Stackoverflowand the main answer concludes:

Stackoverflow上已经讨论过类似的问题,主要答案总结如下:

not yet fully usable,
but keep watching

尚未完全可用,
但请继续关注

Since the discussion is well over a year old, I wonder whether this conclusion is still valid. Should I choose Doxygen over Sphinx for my C++ documentation?

由于讨论已经一年多了,我想知道这个结论是否仍然有效。我应该为我的 C++ 文档选择 Doxygen 而不是 Sphinx?

采纳答案by lunaryorn

Sphinx cannot extract documentation from C++ sources in and by itself. However, there are extensions, most notably Breathe, which utilize Doxygen to extract documentation from C++. I've not tested any of these.

Sphinx 无法单独从 C++ 源中提取文档。但是,也有一些扩展,最著名的是Breathe,它利用 Doxygen 从 C++ 中提取文档。我没有测试过任何这些。

回答by Synxis

For C++ Doxygen is very good; Sphinx support of C++ is done via Doxygen (using Breathe).

对于 C++ Doxygen 非常好;Sphinx 对 C++ 的支持是通过 Doxygen 完成的(使用Breathe)。

You want to have only one tool for the two languages, to improve maintainability. Doxygen can generate a documentation from Python code, so I advise you to use Doxygen for both sources, if possible. Here is a tutorial for Doxygen and Python.

您希望只有一种工具可以用于两种语言,以提高可维护性。Doxygen 可以从 Python 代码生成文档,因此我建议您尽可能将 Doxygen 用于这两个来源。这是 Doxygen 和 Python 的教程