The My Answer
(另请参阅我在该问题下的评论,描述了kaldi
解决方案。)
Note: 这个问题解决后,又出现了一个问题。请参阅此答案的底部以获取帮助。
我一直在研究这个问题,我发现答案最终是改变有问题的行(以及其他一些行),正如我将展示的那样。提醒一下,有问题的行来自文件,src/asclite/core/recording.h
recording.h:122:28: error: template argument 2 is invalid
map<string, Filter::Filter*> filters;
我把它改为
map<string, ::Filter*> filters;
我也做了同样的改变(Filter::Filter*
to ::Filter*
) in src/asclite/core/recording.cpp
,第 157 行和第 164 行,结果为:
157: map<string, ::Filter*>::iterator fi, fe;
164: ::Filter* ptr_elt = fi->second;
在寻找答案和解释时,我还发现另一页有解决方案,但没有解释。
下面的解释中有一个“让我澄清一下”注释,阐述了这只是安装的部分解决方案这一事实。
研究和(希望)解释
我首先注意到相关行之前和之后的声明没有命名空间和双冒号,而我们的行有Filter::Filter*
,如下所示:
$ cat src/asclite/core/recording.h |头 -n 130 |尾-24
地图对齐器;
/**
* contain all the available Scorer
*/
map<string, Scorer*> scorer;
/**
* contain all the available Segmentors
*/
map<string, Segmentor*> segmentors;
/**
* contain all the available Filters
*/
map<string, Filter::Filter*> filters;
/**
* Database for the optimization speaker alignment
*/
SpeakerMatch* m_pSpeakerMatch;
/** the logger */
static Logger* logger;
我首先尝试删除Filter
命名空间和两个冒号 (::
)。我发现了一些网站(1, 2, 3,...),头文件中似乎没有名称空间和双冒号的示例。它们仅存在于实施文件中。我删除了Filter::
(来自有问题的行和其他一些行recording.cpp
),但这给了我
In file included from main.cpp:20:0:
recording.h:122:28: error: template argument 2 is invalid
map<string, Filter*> filters;
^
recording.h:122:28: error: template argument 4 is invalid
在研究了双引号运算符(例如here),并在其他解决方案的帮助下,我改变了所有Filter::Filter*
to ::Filter
.
It compiled with some warnings, but the rest of the installation process worked. Let me clarify The make config
and make all
parts worked. There were errors in the make test
part, detailed in another question here (to be asked). However, running make install
creates the executables that I need.
有关前置双冒号的信息,我得到了一些帮助另一个SO帖子。构造函数之前的两个冒号“粘在”上,让我们知道它位于全局范围内,即在 reporting.h/.cpp 之外。这是必要的,因为在recording.h/.cpp
, 还有另一种Filter
方法为Recording
对象已创建。 (当我写这篇文章时,事情变得越来越清晰。)
$ cat src/asclite/core/recording.cpp | head -n 290 | tail -5
/**
* Filter the references and hypothesis with the availables filters.
*/
void Recording::Filter(const vector<string> & _filters)
{
$ cat src/asclite/core/recording.h | head -n 75 | tail -4
/**
* Filter the references and hypothesis with the availables filters.
*/
void Filter(const vector<string> & _filters);
我认为我们没有命名空间的原因(即没有Filter
之前::
) 已解释这里就这样。在这篇文章中,给出了 .cpp(实现)文件中构造函数的代码并进行了解释:
Mems::Mems() //you don't actually need to use the class keyword in your .cpp file;
just the class name, the double colon, and the method name is enough to mark this
as a class method
据我了解,把Filter::Filter
在代码中Recording
对象会建议Filter::Filter
是一个类方法Recording
对象,但这没有意义,因为第一个Filter
在冒号之前显然将其标记为 a 的类方法Filter
目的。
如果此解释错误或不清楚,请立即修复。
该解决方案解决了问题中的问题,但有还有更多事要做在检查安装成功之前。