我在github上clone了一个人的代码,作者说他用gcc 4.8.4是成功的。于是我用homebrew 装了gcc48. 现在我电脑的gcc 版本是4.8.5 。可是跑代码的时候出现了error:
g++-4.8 -c -pipe -O3 BurstyBTM.cpp -o BurstyBTM.o
BurstyBTM.cpp: In member function 'Pvec<double> BurstyBTM::compute_pz_b(Biterm&)':
BurstyBTM.cpp:129:23: error: could not convert 'pz.Pvec<T>::normalize<double>(0.0)' from 'void' to 'Pvec<double>'
return pz.normalize();
^
BurstyBTM.cpp: In member function 'void BurstyBTM::save_pz(std::string)':
BurstyBTM.cpp:158:41: error: conversion from 'void' to non-scalar type 'Pvec<double>' requested
Pvec<double> pz = nb_z.normalize(alpha);
^
BurstyBTM.cpp: In member function 'void BurstyBTM::save_pw_z(std::string)':
BurstyBTM.cpp:164:37: error: conversion from 'void' to non-scalar type 'Pmat<double>' requested
Pmat<double> pw_z = nwz.normr(beta);
^
make: *** [BurstyBTM.o] Error 1
现在剩下的error:
BurstyBTM.cpp:164:16: error: no viable conversion from 'void' to 'Pmat<double>'
Pmat<double> pw_z = nwz.normr(beta);
^ ~~~~~~~~~~~~~~~
./Pmat.h:29:7: note: candidate constructor (the implicit copy constructor) not viable: cannot convert argument of incomplete type 'void' to 'const Pmat<double> &'
class Pmat {
^
./Pmat.h:50:3: note: candidate template ignored: could not match 'Pmat<type-parameter-0-0>' against 'void'
Pmat(const Pmat<T2>& ma) {
^
./Pmat.h:58:3: note: candidate template ignored: could not match 'vector<vector<type-parameter-0-0, allocator<type-parameter-0-0> >, allocator<vector<type-parameter-0-0,
allocator<type-parameter-0-0> > > >' against 'void'
Pmat(const vector<vector<T2> >& ma) {
^
1 error generated.
请问各位大大应该如何解决?谢谢!
编译有错误阿,返回值什么的竟然不一致,是平台问题导致的么。。
虽说作者说用gcc的某个版本能编译成功,但能保证在任意平台上都行么。。
贴上来github的链接阿