sclite (SCTK),C++模板参数 Filter::Filter* 无效.西格温
sclite (SCTK), C++ template argument, Filter::Filter* , is invalid. Cygwin
>问题
我目前正在尝试安装 NIST 的sclite
,它是 SCTK 2.4.0(github 或更新版本(的一部分。我正在尝试在bash
的Cygwin
上安装。安装是使用make
完成的。
我能够通过进行 64 位编译来解决file [format] not recognized
问题,如自述文件末尾所述,以及在我的另一篇 SO 帖子中详细解释的那样。
现在,我再次按照安装说明进行操作,并在键入make all
后出现以下错误
In file included from main.cpp:20:0:
recording.h:122:36: error: template argument 2 is invalid
map<string, Filter::Filter*> filters;
^
recording.h:122:36: error: template argument 4 is invalid
make[3]: *** [makefile:59: main.o] Error 1
make[3]: Leaving directory
'/cygdrive/c/Me/programs/nist/sctk/src/asclite/core'
make[2]: *** [makefile:12: all] Error 2
make[2]: Leaving directory
'/cygdrive/c/Me/programs/nist/sctk/src/asclite'
make[1]: *** [makefile:12: all] Error 2
make[1]: Leaving directory '/cygdrive/c/Me/programs/nist/sctk/src'
make: *** [makefile:20: all] Error 2
有谁知道我能做什么来完成安装?
注意:当这里的问题得到回答时,安装实际上并没有在Cygwin上完成。之前和之后都有事情要做,我正在 SO 上发布我的进步和关于下一步去哪里的问题。
我的尝试
我在C++文档中没有找到有关Filter
的任何内容,并且搜索克隆目录($ find . -type f ( -name "*.h" -o -name "*.c" -o -name "*.cpp" ) -print0 | xargs -I'{}' -0 grep -Hn "Filter" {}
(中的文件,部分给出:
./src/asclite/core/checker.h:26:class Checker : public Filter
./src/asclite/core/filter.cpp:19: * Abstract interface to a Filter.
./src/asclite/core/filter.cpp:25:Filter::Filter()
./src/asclite/core/filter.cpp:30:Filter::~Filter()
./src/asclite/core/filter.h:26: * Abstract interface to a Filter.
./src/asclite/core/filter.h:28:class Filter
./src/asclite/core/filter.h:32: Filter();
./src/asclite/core/filter.h:34: virtual ~Filter();
...
据我所知,这意味着有一个构造函数,Filter
命名空间中,Filter
.
这是filter.cpp
的"代码部分"
$ cat src/asclite/core/filter.cpp | tail -16
/**
* Abstract interface to a Filter.
*/
#include "filter.h" // class's header file
// class constructor
Filter::Filter()
{
}
// class destructor
Filter::~Filter()
{
}
这是filter.h
的代码部分
$ cat src/asclite/core/filter.h | tail -27
#ifndef FILTER_H
#define FILTER_H
#include "stdinc.h"
#include "speech.h"
#include "speechset.h"
/**
* Abstract interface to a Filter.
*/
class Filter
{
public:
// class constructor
Filter();
// class destructor
virtual ~Filter();
virtual bool isProcessAllSpeechSet() = 0;
virtual unsigned long int ProcessSingleSpeech(Speech* speech) = 0;
virtual unsigned long int ProcessSpeechSet(SpeechSet* ref, map<string, SpeechSet*> &hyp) = 0;
virtual void LoadFile(const string& filename) = 0;
};
#endif // FILTER_H
系统详细信息
$ uname -a
CYGWIN_NT-6.1 CAP-D-ENG-INT3 2.10.0(0.325/5/3) 2018-02-02 15:16 x86_64 Cygwin
$ bash --version
GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin) ...
$ gcc --version
gcc (GCC) 6.4.0 ...
$ g++ --version
g++ (GCC) 6.4.0 ...
$ make --version
GNU Make 4.2.1
Built for x86_64-unknown-cygwin ...
$ systeminfo | sed -n 's/^OS *//p'
Name: Microsoft Windows 7 Enterprise
Version: 6.1.7601 Service Pack 1 Build 7601
Manufacturer: Microsoft Corporation
Configuration: Member Workstation
Build Type: Multiprocessor Free
我的答案
(另请参阅我在问题下的评论,描述kaldi
解决方案。
注意:解决此问题后,还出现了另一个问题。请参阅此答案的底部以获取帮助。
我一直在努力,我发现答案最终是改变有问题的行(和其他一些(,正如我将展示的那样。提醒一下,有问题的行来自文件,src/asclite/core/recording.h
recording.h:122:28: error: template argument 2 is invalid
map<string, Filter::Filter*> filters;
我把它改成了
map<string, ::Filter*> filters;
我也在src/asclite/core/recording.cpp
的第157行和第164行做了同样的更改(Filter::Filter*
到::Filter*
(,结果是:
157: map<string, ::Filter*>::iterator fi, fe;
164: ::Filter* ptr_elt = fi->second;
在寻找答案和解释时,我还发现了另一个有解决方案的页面,但没有解释。
下面的解释中有一个"让我澄清一下"注释,阐述了这只是安装的部分解决方案的事实。
研究和(希望(解释
我首先注意到有问题的行之前和之后的声明没有命名空间和双冒号,而我们的行有Filter::Filter*
,如下所示:
$ cat src/asclite/core/recording.h | head -n 130 | tail -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
在研究了双引号运算符(例如这里(之后,在另一个解决方案的帮助下,我将所有Filter::Filter*
更改为::Filter
。
它编译了一些警告,但安装过程的其余部分有效。让我澄清一下make config
和make all
部分起作用了。make test
部分有错误,详见这里的另一个问题(待问(。但是,运行make install
会创建我需要的可执行文件。
有关前缀双冒号的信息,我从另一个 SO 帖子中得到了一些帮助。在构造函数之前,两个冒号"卡在"让我们知道它在全局范围内,即在 recording.h/.cpp 之外。这是必要的,因为在recording.h/.cpp
中,创建的Recording
对象还有另一种Filter
方法。(在我写作的过程中,事情变得越来越清晰。
$ 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
(在 SO 上得到了解释。在这篇文章中,给出了.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
显然将其标记为Filter
对象的类方法。
如果此解释错误或不清楚,请随时修复它。
此解决方案解决了问题中的问题,但在成功检查安装之前还有更多工作要做。
- Openssl 1.1.1d无效使用不完整的类型"struct dsa_st"
- 无法访问嵌套类.类的使用无效
- 如果用户输入无效,如何使用字符串变量-C++重复输入命令
- 如何解决错误:SCIP C++中的 SCIP 阶段无效 <10>
- 在没有参数列表的情况下使用模板名称"Event"无效,模板问题
- FFMPEG配置文件级别id大小无效
- 错误:从"int"到枚举c++的转换无效
- 如何修复此错误:className::className的无效使用
- 为什么将值返回函数传递给重载=运算符对运算符函数有效,而对其他运算符无效
- C++-模板嵌套类的引用初始化无效
- 错误:无效的预处理指令 #i 的意思是 #if?
- 多维数组 C++ 中数组下标的类型"int[int]"无效
- 在 C++ 中使用正则表达式错误时出现问题 括号表达式中的范围无效
- 从 'int' 到 'int*' CPP 的转换无效
- 如何接受 [ENTER] 键作为无效输入并发送错误消息
- 由于无效的 ValidateRgn() 子窗口不会收到WM_PAINT消息
- C++ PTHREADS - 无效转换无效*(*)()到无效*(*)(无效*)
- 声明为无效的变量或字段'...' Ardunio 编译器上的错误
- 数组下标的类型"float*[float]"无效
- sclite (SCTK),C++模板参数 Filter::Filter* 无效.西格温