我在 org babel 中使用 C++,想知道如何格式化包含,以便我可以列出多个。
这是我正在尝试的(失败)
#+BEGIN_SRC C++ :includes <cstdio> :includes <iostream> :includes <string>
using namespace std;
printf("Hello ");
cout << "world\n";
#+END_SRC
在这种情况下,两者printf
和cout
都未在此范围内声明。我可以:includes <string>
从标题中删除不必要的内容并且cout
不会引发错误,所以看起来只有最后一个:includes
重要。我尝试使用空、逗号和空格作为分隔符将多个包含加载到同一行中,并且我总是在包含指令的末尾收到有关额外标记的错误。我也尝试过使用:includes+
在标题行上有效的情况,但它没有。
我相当确定我正在尝试做的事情应该是可能的,因为它在文档中说
:includes
(C & CC+ only) accepts either a single string name, or a list of names of files to #include in the execution of the code block
组织版本:8.2.7-4-g880362-elpa
编辑:
值得注意的是,其他标头参数可以串在一起(即:results raw drawer
会在抽屉中产生未格式化的结果),因此很有可能这是一个错误。使用:include <cstdio> <iostream>
会产生一个编译器错误,即在行尾有一个额外的标记#include <cstdio>
。
编辑2:
原来它实际上是org中的一个错误,所以它已经提交了。