C++错误:表达式不能用作函数



几年前我用C++编写了一个程序,我经常使用它。这个程序使用了一个名为LTENSOR的库,我只是使用它,我并不完全知道那里发生的一切。2天前,在Ubuntu 18.04的新安装后,我安装了最新版本的gcc编译器(Ubuntu 7.5.0-3ubuntu1~18.04(。现在,当我运行我运行了几年的相同程序时,我得到了以下错误:

包含在/home/alex/Documents/My Soilab/Soillab/ltensor/中的文件中/base/Array_base.h:29:0,来自/home/alex/Documents/My Soilab/Soillab/ltensor/ltensor.h:32,来自/home/alex/Documents/My Soilab/Soillab/Soillab.cpp:14:/home/alex/Documents/My Soilab/Soillab/ltensor//基本//storage/storage.h:在成员函数"long int GenericStorage::getBeginAddress(int,int("中:/home/alex/Documents/My Soilab/Soillab/ltensor//基本//storage/storage.h:207:62:错误:表达式不能用作函数gsize=(dim==0?0:步幅(getPos(排序,dim-1,秩((;^[在0.9秒内完成,退出代码为1][shell_cmd:g++"/home/alex/Documents/My Soilab/Soillab/Soillab.cpp"-o"/home/alex/Documents/My Soillab/Soillab"][dir:/home/alex/Documents/My Soilab/Soillab][路径:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/games:/snap/bin]

它似乎来自下面的代码

long getBeginAddress(int offset,int dim){
long gsize=0;
gsize= (dim==0?0: stride(getPos(ordering,dim-1,rank) )) ;
return gsize+offset;
}

我不明白我为什么会犯这个错误。谢谢

违规行

gsize= (dim==0?0: stride(getPos(ordering,dim-1,rank) )) ;

似乎源自https://github.com/lromor/ltensor/blob/master/ltensor/storage/storage.h#L207

但是在第84行,stride被声明为long* stride:https://github.com/lromor/ltensor/blob/master/ltensor/storage/storage.h#L84

所以stride是一个指针,而不是一个函数。

最新更新