Forum: PC-Programmierung libFTDI im Qt-Creator linken


von Aribert B. (aribert)


Lesenswert?

Hallo,

ich habe Probleme beim Linken von libftdi im Qt-Creator.
Für eine RS485-Anbindung (Datenbus) über USB habe ich mit der 
libftdi-0.20
(C-Version) versucht, einige Daten auszutauschen.
Jetzt möchte ich den "Transceiver" im Qt-Creator mit einbinden.

Dazu habe ich die Projektdatei angepasst:

LIBS += -L/usr/lib \
    -lusb \
    -L/usr/lib \
    -llibftdi.la

und versucht zu übersetzen, mit der Fehlermeldung:

Führe Build-Schritte für Projekt ftdi aus...
Konfiguration unverändert, überspringe QMake-Schritt.
Starte: /usr/bin/make -w
make: Gehe in Verzeichnis '/home/arboerner/qt++/ftdi'
g++ -o ftdi rs485.o -L/usr/lib -L/usr/lib -lusb -llibftdi.la -lQtGui 
-lQtCore -lpthread
/usr/bin/ld: cannot find -llibftdi.la
collect2: ld returned 1 exit status
make: Verlasse Verzeichnis '/home/arboerner/qt++/ftdi'
make: *** [ftdi] Fehler 1
Beendet mit Rückgabewert 2.
Fehler beim Erstellen des Projekts ftdi
Beim Ausführen des Build-Schritts 'Make'

Die libftdi.la ist in /usr/lib und in /usr/local/lib installiert.

arboerner@arboerner-desktop:~$ cd /usr/lib/
arboerner@arboerner-desktop:/usr/lib$ ls -la |grep ftdi
-rw-r--r--   1 root root    60756 2012-10-09 12:25 libftdi.a
-rw-r--r--   1 root root      948 2012-10-09 12:26 libftdi.la
-rw-r--r--   1 root root    42686 2010-01-18 08:53 libftdipp.a
-rw-r--r--   1 root root      980 2010-01-18 08:53 libftdipp.la
lrwxrwxrwx   1 root root       19 2012-10-09 09:36 libftdipp.so -> 
libftdipp.so.1.17.0
lrwxrwxrwx   1 root root       19 2012-10-09 09:36 libftdipp.so.1 -> 
libftdipp.so.1.17.0
-rw-r--r--   1 root root    34472 2010-01-18 08:53 libftdipp.so.1.17.0
lrwxrwxrwx   1 root root       17 2012-10-09 09:36 libftdi.so -> 
libftdi.so.1.17.0
lrwxrwxrwx   1 root root       17 2012-10-09 09:36 libftdi.so.1 -> 
libftdi.so.1.17.0
-rw-r--r--   1 root root    25980 2010-01-18 08:53 libftdi.so.1.17.0
-rwxr-xr-x   1 root root    61823 2012-10-09 12:31 libftdi.so.1.20.0
arboerner@arboerner-desktop:/usr/lib$ cd ../local/lib
arboerner@arboerner-desktop:/usr/local/lib$ ls -la |grep ftdi
-rw-r--r--  1 root root  60756 2012-07-06 11:21 libftdi.a
-rwxr-xr-x  1 root root    948 2012-07-06 11:21 libftdi.la
lrwxrwxrwx  1 root root     17 2012-07-06 11:21 libftdi.so -> 
libftdi.so.1.20.0
lrwxrwxrwx  1 root root     17 2012-07-06 11:21 libftdi.so.1 -> 
libftdi.so.1.20.0
-rwxr-xr-x  1 root root  61345 2012-07-06 10:06 libftdi.so.1.18.0
-rwxr-xr-x  1 root root  61653 2012-07-06 10:09 libftdi.so.1.19.0
-rwxr-xr-x  1 root root  61823 2012-07-06 11:21 libftdi.so.1.20.0
arboerner@arboerner-desktop:/usr/local/lib$

Vielleicht hatte von euch schon einmal das gleiche Problem und kennt 
eine
Lösung.

Danke schon jetzt im voraus.

von Εrnst B. (ernst)


Lesenswert?

Die ".la"-Files sind für "libtool", bei qmake brauchst du die IIRC 
nicht. Also direkt das ".so"-File verwenden, und da brauchst du die 
extension nicht.

Und das "lib" am Anfang macht der Linker selber dazu, also
"-lftdi" reicht.

Und einmal "-L/usr/lib" reicht auch. Eigentlich sollte man es garnicht 
benötigen, da default-Pfad...


d.H.

LIBS += -lusb -lftdi

oder

LIBS += -L/usr/local/lib -lusb -lftdi

und fertig. :)

von Aribert B. (aribert)


Lesenswert?

prima er funktioniert !!

Danke, danke !!

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.