无法找到libfreenect

时间:2013-03-28 14:10:31

标签: c++ kinect

我正在尝试使用kinect的简单程序。我已经安装了libfreenect和libpng包。我也尝试下载头文件并将其包含在代码中,但它无法正常工作。我在ubuntu 12.04上运行。我遇到以下错误:

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

这是该程序的makefile:

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

0 个答案:

没有答案