错误如下:
make -C src/ -f Makefile all
make[1]: Entering directory '/media/fanyangfeng/windoc/lecom/lecomwork/auto_feedback/lda/GibbsLDA++-0.2/src'
g++ -c -o utils.o utils.cpp
utils.cpp: In static member function ‘static int utils::parse_args(int, char**, model*)’:
utils.cpp:69:28: error: ‘atof’ was not declared in this scope
alpha = atof(argv[++i]);
^
utils.cpp:72:27: error: ‘atof’ was not declared in this scope
beta = atof(argv[++i]);
^
utils.cpp:75:24: error: ‘atoi’ was not declared in this scope
K = atoi(argv[++i]);
^
utils.cpp:78:29: error: ‘atoi’ was not declared in this scope
niters = atoi(argv[++i]);
^
utils.cpp:81:31: error: ‘atoi’ was not declared in this scope
savestep = atoi(argv[++i]);
^
utils.cpp:84:29: error: ‘atoi’ was not declared in this scope
twords = atoi(argv[++i]);
^
utils.cpp: In static member function ‘static int utils::read_and_parse(std::__cxx11::string, model*)’:
utils.cpp:270:41: error: ‘atof’ was not declared in this scope
pmodel->alpha = atof(optval.c_str());
^
utils.cpp:273:40: error: ‘atof’ was not declared in this scope
pmodel->beta = atof(optval.c_str());
^
utils.cpp:276:37: error: ‘atoi’ was not declared in this scope
pmodel->K = atoi(optval.c_str());
^
utils.cpp:279:37: error: ‘atoi’ was not declared in this scope
pmodel->M = atoi(optval.c_str());
^
utils.cpp:282:37: error: ‘atoi’ was not declared in this scope
pmodel->V = atoi(optval.c_str());
^
utils.cpp:285:41: error: ‘atoi’ was not declared in this scope
pmodel->liter = atoi(optval.c_str());
^
Makefile:17: recipe for target 'utils.o' failed
make[1]: *** [utils.o] Error 1
make[1]: Leaving directory '/media/fanyangfeng/windoc/lecom/lecomwork/auto_feedback/lda/GibbsLDA++-0.2/src'
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 2
在http://blog.sciencenet.cn/blog-425672-654209.html找到答案,解决办法
解决方法:
1). 在src/utill.cpp 文件头加入:
#include<stdio.h> #include<stdlib.h>
2). 在src/utill.h 文件头加入:
#include<stdlib.h>
3). 在src/lda.cp 文件头加入:
#include<stdio.h>
4). 重新make
No comments:
Post a Comment