/extractor/backoff_sampler.cc:24:18:错误:'round'未在此范围内声明

/extractor/backoff_sampler.cc:24:18:错误:'round'未在此范围内声明

我正在尝试建立中央结算公司在 Ubuntu 18.04.1 LTS 上(在 Windows 10 上的 VirtualBox 中运行)。请注意,我根本不是一个经验丰富的 Linux 高级用户。

我执行了上述 cdec repo 中给出的命令:

cmake .
make -j4
make test
./tests/run-system-tests.pl

但是,在过程中make我遇到了一个错误,我无法找到跟踪。禁用多线程并设置 VERBOSE ( make VERBOSE=1) 后,我得到了以下跟踪:

[ 79%] Building CXX object extractor/CMakeFiles/extractor.dir/backoff_sampler.cc.o
cd /tmp/cdec/build/extractor && /usr/bin/c++  -DHAVE_CONFIG_H -DKENLM_MAX_ORDER=6 -I/tmp/cdec -I/tmp/cdec/build -I/usr/include/eigen3 -I/tmp/cdec/extractor/../utils -I/tmp/cdec/extractor -I/tmp/cdec/extractor/features  -Wall -std=c++11 -O3 -g -fopenmp   -o CMakeFiles/extractor.dir/backoff_sampler.cc.o -c /tmp/cdec/extractor/backoff_sampler.cc
/tmp/cdec/extractor/backoff_sampler.cc: In member function ‘virtual extractor::PhraseLocation extractor::BackoffSampler::Sample(const extractor::PhraseLocation&, const std::unordered_set<int>&) const’:
/tmp/cdec/extractor/backoff_sampler.cc:24:18: error: ‘round’ was not declared in this scope
     int sample = round(i);
                  ^~~~~
/tmp/cdec/extractor/backoff_sampler.cc:24:18: note: suggested alternative: ‘rand’
     int sample = round(i);
                  ^~~~~
                  rand
extractor/CMakeFiles/extractor.dir/build.make:86: recipe for target 'extractor/CMakeFiles/extractor.dir/backoff_sampler.cc.o' failed

我根本不是 C++ 开发人员,但我认为源代码是为具有本机round()函数(或类似的东西?)的编译器编写的,但在我的设置中并非如此。

我不确定哪些信息可能有用,因此做出以下猜测:

  • Ubuntu 18.04.1 LTS
  • gcc(Ubuntu 7.3.0-16ubuntu3)7.3.0
  • GNU Make 4.1

我估计我可能需要对源代码进行一些更改,但我不知道该更改什么或用什么替换。欢迎提供任何指示。

注意:错误已向开发商报告

答案1

我建议您删除程序文件夹并从存档中安装一个新文件夹。您的安装已进行到 79%,并出现错误“extractor.dir / backoff_sampler”,要解决这个问题,您需要在新的解压程序中重新创建(从末尾开始)“cdec”文件夹。(我在硬盘上使用了 Ubuntu 18.04.3 LTS)。

# apt install cmake git build-essential libboost-dev libboost-regex-dev libboost-filesystem-dev libboost-serialization-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libeigen3-dev libbz2-dev liblzma-dev flex libgtest-dev

# git clone https://github.com/redpony/cdec.git

# cd cdec 

# apt update

# apt install golang-github-cenkalti-backoff-dev

# cmake .

# make -j4

# reboot

# cd cdec

# cmake .

# make -j4

相关内容