macos - 在os x 10.10 上用gcc48编译c++失败
PHP中文网
PHP中文网 2017-04-17 13:24:25
0
1
698

我在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.

请问各位大大应该如何解决?谢谢!

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
迷茫

There is an error in compilation. The return values ​​are inconsistent. Is it caused by a platform problem? .
Although the author said that it can be compiled successfully using a certain version of gcc, but can it be guaranteed that it will work on any platform? .
Post the link to github

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template