'int'之前的预期primary-expression尝试调用函数

时间:2014-06-12 13:55:19

标签: c++

当我调用函数mooreNeighbor时,我收到错误:

  

在'int'之前预期的primary-expression

错误发生在正在进行通话的线路上。

Barray是一个1s和0s的(int)1D数组。宽度和高度都是整数。所有三个都用值初始化。

来自main.cc的第86-87行:

//#include "contour-tracing.h" is included at the top of the file Barray = mooreNeighborTracing(int * Barray, width, height);

来自contour-tracing.h:

// @author Erik Smistad <smistad@idi.ntnu.no>
#ifndef CONTOURTRACING_H_
#define CONTOURTRACING_H_

#include <stdlib.h>

int * padImage(int * Barray, int width, int height,int zero);
int * mooreNeighborTracing(int * Barray, int height, int width);

#endif /* CONTOURTRACING_H_ */

还有另一个文件contour-tracing.cpp,其中存在算法。我也可以发布信息。

1 个答案:

答案 0 :(得分:0)

按以下方式调用该功能

Barray = mooreNeighborTracing(Barray, width, height);

我认为Barray是一个指针,它被声明为

int *Barray /* = some initializer as for example an expression with the operator new */;

如果Barray被定义为数组,那么您可能无法分配它。似乎在这种情况下该函数应该被称为

mooreNeighborTracing(Barray, width, height);