unable to find libfreenect

我是研究僧i 提交于 2019-12-13 06:19:36

问题


I am trying a simple program using kinect. I have installed both libfreenect and libpng packages. I also tried downloading the header file and including it in the code but it is not working. I am running on ubuntu 12.04.I am getting following errors:

cc -O3  -lpng `pkg-config libfreenect --libs --cflags` -o kinect-depth-ascii kinect.o image.o buffer.o kinect-depth-ascii.c
/tmp/ccPavHLk.o: In function `draw_depth_image':
kinect-depth-ascii.c:(.text+0x131): undefined reference to `Image_get_pixel'
kinect.o: In function `kinect_capture_depth_image':
kinect.c:(.text+0x55): undefined reference to `Image_set_pixel'
kinect.o: In function `kinect_initialize':
kinect.c:(.text+0x15c): undefined reference to `freenect_init'
kinect.c:(.text+0x179): undefined reference to `freenect_select_subdevices'
kinect.c:(.text+0x40c): undefined reference to `freenect_set_led'
image.o: In function `Image_get_png_write_data':
image.c:(.text+0x2b): undefined reference to `png_get_io_ptr'
image.o: In function `Image_write_png_internal':
image.c:(.text+0x119): undefined reference to `png_create_write_struct'
image.c:(.text+0x12d): undefined reference to `png_create_info_struct'
image.o: In function `Image_downsample':
image.c:(.text+0x490): undefined reference to `lround'
image.c:(.text+0x4c9): undefined reference to `lround'
collect2: ld returned 1 exit status
make: *** [kinect-depth-ascii] Error 1

This is makefile of the program:

all: kinect-depth-ascii kinect-depth-png

#CFLAGS=-O3 -I/usr/local/include/libfreenect
#LDFLAGS=-lpng -lfreenect
CFLAGS=-O3 
LDFLAGS=-lpng `pkg-config libfreenect --libs --cflags`

kinect-depth-ascii: kinect.o image.o buffer.o kinect-depth-ascii.c
    cc $(CFLAGS) $(LDFLAGS) -o $@ $^

kinect-depth-png: kinect.o image.o buffer.o kinect-depth-png.c
    cc $(CFLAGS) $(LDFLAGS) -o $@ $^

kinect.o: kinect.h kinect.c
    cc $(CFLAGS) -c kinect.c

image.o: image.h image.c
    cc $(CFLAGS) -c image.c

buffer.o: buffer.h buffer.c
    cc $(CFLAGS) -c buffer.c

clean:
    rm -f *.o kinect-depth-ascii kinect-depth-png

来源:https://stackoverflow.com/questions/15684046/unable-to-find-libfreenect

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