Re: [anjuta-devel] Linker path for libusb-1.0



Hi Axel,


Le 07/06/2015 17:31, axel a écrit :
/home/axel/gtk-foobar/src/main.c:141: not defined refernce to `libusb_init'
/home/axel/gtk-foobar/src/main.c:144: not defined refernce to `libusb_open_device_with_vid_pid'
in my 'main.c' I included:
#include <libusb-1.0/libusb.h>
and the appropriate flags in makefile are:
LIBUSB_CFLAGS = -I/usr/include/libusb-1.0

This is fine for the C compiler, but the error comes from the linker.


LIBUSB_LIBS = -lusb-1.0

This is not enough.


Changing LIBUSB_CFLAGS to/lib/x86_64-linux-gnu/  or/lib/i386-linux-gnu/
has no effect.
The compiler is fine (so the header seems to be ok for me).

Yes.


Did I ran into a quirk due to different usb libs? Or how can I tell to Anjuta the correct lib path?
Lib was added with "Project/add library"

Do you use a simple makefile or an autotools project?
If the first case, Anjuta has no write support for a simple makefile so you need to add LIBUSB_LIBS in the argument of the linker.

In the second case, Anjuta should be able to modify the Makefile.am correctly. I think you miss the -lusb-1-0 in the argument of the linker. Normally you should have a variable named _your_program_name_LDADD which include $(LIBUSB_LIBS).


Regards,

Sébastien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]