GCC linking order

Claudio Bley bley@mail.cs.uni-magdeburg.de
Tue Jan 18 10:16:00 GMT 2005


On Sat, Jan 15, 2005 at 01:40:03PM +0000, Yann Le Doaré wrote:
> Hi evrybody !
> 
> I tried to compile the "cxacru" DSL driver for linux, but when linking 
> tools i had those errors :
> 
> gcc -O2 -Wstrict-prototypes -fomit-frame-pointer -pipe -march=i686 -Wall 
> -DLINUX -I../include -I/usr/linuxconsole/core/include -lusb -lpthread 
> -L/usr/linuxconsole/core/lib cxload.c -o cxload
> /tmp/cc31iLZF.o(.text+0x17a): In function `transfer_ctrl_msg':
> : référence indéfinie vers « usb_control_msg »
> /tmp/cc31iLZF.o(.text+0x185): In function `transfer_ctrl_msg':
> : référence indéfinie vers « usb_strerror »
> /tmp/cc31iLZF.o(.text+0x220): In function `transfer_ctrl_msg':
> : référence indéfinie vers « usb_clear_halt »
> /tmp/cc31iLZF.o(.text+0x234): In function `transfer_ctrl_msg':
> : référence indéfinie vers « usb_clear_halt »
> /tmp/cc31iLZF.o(.text+0x27c): In function `read_bulk':
> : référence indéfinie vers « usb_bulk_read »
> 
> .....
> 
> but when I move "cxload.c -o cxload" from the end to the beginning of 
> command, all is OK
> 
> gcc  cxload.c -o cxload -O2 -Wstrict-prototypes -fomit-frame-pointer 
> -pipe -march=i686 -Wall -DLINUX -I../include 
> -I/usr/linuxconsole/core/include -lusb -lpthread 
> -L/usr/linuxconsole/core/lib                  
> 
> 
> Do you think it is a GCC bug ?

No, not at all since this is a linker issue. But it is no bug
whatsoever. This is expected to work like this.

--
Claudio



More information about the Gcc-help mailing list