Lear Gist Descriptor C code used with C++

六眼飞鱼酱① 提交于 2020-02-03 18:48:09

问题


I am using Lear's implementation of the Gist descriptor for a project which can be found here: http://lear.inrialpes.fr/software.

I am writing an application in c++ and I want to use this library. I am having issues though with the makefile and linking in general.

These commands give me no errors:

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

However, this line

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

gives me the following error

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

I have the Mosaic c++ code in a different directory. I also tried to compile gist and standalone_image seperately, copy into the mosaic directory, and compile the Mosaic code. Which gives me the following error:

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

I really want to use this library in my project, but I can't figure out a way to incorporate it in my c++.

Any help is GREATLY appreciated! Thanks!

Edit: I am using Mac Lion with:

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)

The lear library also uses the FFTW3 library that should work with C and C++.


回答1:


The problem was that I needed the extern around the gist include, but the linking that was done in the Makefile was also wrong. It works now. :)



来源:https://stackoverflow.com/questions/10051221/lear-gist-descriptor-c-code-used-with-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!