-2

可能重复:
对 void “function” C++ 的未定义引用

我得到错误:

undefined reference to `void Convolve<float>(CImageOf<float>, CImageOf<float>&, CImageOf<float>)'   features.cpp    /cv-pj      C/C++ Problem

但是,在进行全局搜索时,我找不到任何我调用与这些类型进行卷积的实例。

这是我的标题中的内容:

template <class T>
void Convolve(CImageOf<T> src, CImageOf<T>& dst,
              CFloatImage kernel);

有什么问题?请注意,这实际上是在 Windows 上编译的,但我使用的是 ubuntu 64bit gcc

编辑:我在 Eclipse 上,它显示错误在第 0 行。这是什么意思?

完整错误:

features.o: In function `computeHarrisValues(CImageOf<float>&, CImageOf<float>&)':
features.cpp:(.text+0x4f6): undefined reference to `void Convolve<float>(CImageOf<float>, CImageOf<float>&, CImageOf<float>)'
features.cpp:(.text+0x63e): undefined reference to `void Convolve<float>(CImageOf<float>, CImageOf<float>&, CImageOf<float>)'
features.cpp:(.text+0xa60): undefined reference to `void Convolve<float>(CImageOf<float>, CImageOf<float>&, CImageOf<float>)'
features.cpp:(.text+0xbd1): undefined reference to `void Convolve<float>(CImageOf<float>, CImageOf<float>&, CImageOf<float>)'
features.cpp:(.text+0xd42): undefined reference to `void Convolve<float>(CImageOf<float>, CImageOf<float>&, CImageOf<float>)'
features.o:features.cpp:(.text+0x460b): more undefined references to `void Convolve<float>(CImageOf<float>, CImageOf<float>&, CImageOf<float>)' follow
features.o: In function `ComputeMOPSDescriptors(CImageOf<float>&, FeatureSet&)':
features.cpp:(.text+0x533e): undefined reference to `void ConvolveSeparable<float>(CImageOf<float>, CImageOf<float>&, CImageOf<float>, CImageOf<float>, int)'
collect2: ld returned 1 exit status
make: *** [Features] Error 1
4

1 回答 1

1
template
void Convolve<float>(
   CImageOf<float> src,
   CImageOf<Float>& dst,
   CFloatImage kernel);
于 2012-09-22T18:43:58.457 回答