Lier la libusb à mon projet ?
Bonjour à tous,
J'ai fait pas mal de C, mais je suis noob quant à l'utilisation de gcc / ld / bibliothèque externes. Je souhaite faire un programme où j'utilise la libusb-1.0, sous Ubuntu.
J'ai téléchargé et installé la bibliothèque :
Code:
1 2 3 4 5 6
|
pierre@pierre-Notebook-Ubuntu:/usr/local/include/libusb-1.0$ ll
total 52
drwxr-xr-x 2 root root 4096 2011-12-12 21:54 ./
drwxr-xr-x 3 root root 4096 2011-12-12 21:54 ../
-rw-r--r-- 1 root root 41693 2011-12-12 21:54 libusb.h |
et
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
pierre@pierre-Notebook-Ubuntu:/usr/local/lib$ ll
total 396
drwxr-xr-x 4 root root 4096 2011-12-12 21:54 ./
drwxr-xr-x 10 root root 4096 2011-10-13 09:09 ../
-rw-r--r-- 1 root root 212838 2011-12-12 21:54 libusb-1.0.a
-rwxr-xr-x 1 root root 955 2011-12-12 21:54 libusb-1.0.la*
lrwxrwxrwx 1 root root 19 2011-12-12 21:54 libusb-1.0.so -> libusb-1.0.so.0.0.0*
lrwxrwxrwx 1 root root 19 2011-12-12 21:54 libusb-1.0.so.0 -> libusb-1.0.so.0.0.0*
-rwxr-xr-x 1 root root 171210 2011-12-12 21:54 libusb-1.0.so.0.0.0*
drwxr-xr-x 2 root root 4096 2011-12-12 21:54 pkgconfig/
drwxrwsr-x 4 root staff 4096 2011-10-13 09:13 python2.7/ |
Je fais un programme très simple :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <stdlib.h>
#include <stdio.h>
#include <libusb.h>
int main(void)
{
puts("Debut du programme");
puts("------------------");
struct usb_bus *busses;
usb_init();
puts("Fin du programme");
return EXIT_SUCCESS;
} |
La compilation échoue car gcc ne trouve pas le fichier libusb.h :
Code:
1 2 3 4
|
pierre@pierre-Notebook-Ubuntu:~/Projets/AndroidAccessory$ gcc -o main.o main.c -W -Wall
main.c:3:20: erreur fatale: libusb.h : Aucun fichier ou dossier de ce type
compilation terminée. |
Je pensais pourtant que les dossiers où sont installés ma bibliothèque étaient pas défaut dans le chemin de gcc.... mais en fait non ?
Merci d'avance pour vos conseils ! ;)