3

我正在为一个项目使用 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)

lear 库还使用应该与 C 和 C++ 一起使用的 FFTW3 库。

4

1 回答 1

0

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

于 2012-04-11T17:55:00.090 回答