Lear Gist描述符C代码与C ++一起使用

时间:2012-04-07 02:26:34

标签: c++ c makefile gist

我正在使用Lear的Gist描述符实现项目,可以在这里找到:http://lear.inrialpes.fr/software

我正在用c ++编写应用程序,我想使用这个库。我在使用makefile和链接时遇到问题。

这些命令没有错误:

g++ -c standalone_image.c -o standalone_image.o
g++ -c gist.c -o gist.o

然而,这一行

g++ compute_gist.c `pkg-config --cflags --libs opencv`

给我以下错误

Undefined symbols for architecture x86_64:
  "color_gist_scaletab(color_image_t*, int, int, int const*)", referenced from:
      _main in ccMFYbAU.o
  "color_image_delete(color_image_t*)", referenced from:
      _main in ccMFYbAU.o
  "color_image_new(int, int)", referenced from:
      load_ppm(char const*)in ccMFYbAU.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

我将Mosaic c ++代码放在不同的目录中。我还尝试单独编译gist和standalone_image,复制到mosaic目录中,然后编译Mosaic代码。 这给了我以下错误:

Undefined symbols for architecture x86_64:
  "color_gist_scaletab(color_image_t*, int, int, int const*)", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [mosaic] Error 1

我真的想在我的项目中使用这个库,但是我无法找到将它合并到我的c ++中的方法。

非常感谢任何帮助!谢谢!

编辑:我正在使用Mac Lion:

gcc + g++ version: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

学习库还使用了适用于C和C ++的FFTW3库。

1 个答案:

答案 0 :(得分:0)

问题是我需要围绕gist include的extern,但是在Makefile中完成的链接也是错误的。它现在有效。 :)