I am currently trying to install NIST\'s sclite
, which is part of SCTK 2.4.0 (github or newer version). I am attempting the install on C
(Also look at my comment under the question, describing the kaldi
solution.)
Note: There was another problem which came up after this problem was solved. See the bottom of this answer for help with that.
I kept working on this, and I found the answer ended up being changing the line in question (and some others) as I will show. As a reminder, the line in question was from the file, src/asclite/core/recording.h
recording.h:122:28: error: template argument 2 is invalid
map<string, Filter::Filter*> filters;
I changed it to
map<string, ::Filter*> filters;
I also made the same change ( Filter::Filter*
to ::Filter*
) in src/asclite/core/recording.cpp
, lines 157 and 164, the results being:
157: map<string, ::Filter*>::iterator fi, fe;
164: ::Filter* ptr_elt = fi->second;
In looking for the answer and an explanation, I also found another page that has the solution, but no explanation.
There is a "Let me clarify" note in the explanation below that expounds on the fact that this is only a partial solution to the install.
I first noticed that the declarations before and after the line in question had no namespace and double colon, whereas our line had Filter::Filter*
, as can be seen below:
$ cat src/asclite/core/recording.h | head -n 130 | tail -24 map aligner;
/**
* 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;
I first tried removing both the Filter
namespace and the two colons (::
). I had found a few sites (1, 2, 3, ...), where it seems that there were no examples of namespaces and double colons in header files. They were only in implementation files. I removed Filter::
(from the line in question and from some other lines in recording.cpp
), but that gave me
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
After studying the double-quote operator (e.g. here), and with the help of the other solution, I changed all 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.
For information about the prepended double-colon, I got some help from another SO post. The two colons "stuck on" before the constructor let us know that it is in the global scope, i.e. outside of the recording.h/.cpp. This is necessary, because in recording.h/.cpp
, there is another Filter
method for the Recording
object created. (Things are becoming clearer as I'm writing.)
$ 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);
I think that the reason we don't have a namespace (i.e. there's no Filter
before the ::
) is explained here on SO. In this post, code for a constructor in a .cpp (implementation) file is given with an explanation:
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
As I understand it, putting Filter::Filter
in the code for a Recording
object would suggest that Filter::Filter
is a class method for a Recording
object, but that doesn't make sense, because the first Filter
before the colons obviously marks it as being a class method for a Filter
object.
If this explanation is wrong or unclear, don't hesitate to fix it.
This solution fixed the issue in the question, but there was more to do before the checks for the install succeeded.