ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello, i want to compile a cpp file that call this functions:
usb_init();
for (bus = busses; bus; bus = bus->next) {
usb_find_busses();
usb_find_devices();
I am using this to compile:
gcc -Wall -W -I/a/b/c/include./libusb.a test1.cpp -o test1
but i have a lot of errors.
/tmp/ccseNamp.o(.text+0x1e): In function `main':
prueba1.cpp: undefined reference to `usb_init'
/tmp/ccseNamp.o(.text+0x34):test1.cpp: undefined reference to `usb_find_busses'
/tmp/ccseNamp.o(.text+0x39):test1.cpp: undefined reference to `usb_find_devices'
/tmp/ccseNamp.o(.text+0x55):test1.cpp: undefined reference to `usb_get_busses'
/tmp/ccseNamp.o(.text+0x1b4): In function `__static_initialization_and_destruction_0(int, int)':
prueba1.cpp: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccseNamp.o(.text+0x1e3): In function `__tcf_0':
prueba1.cpp: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccseNamp.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
-----------------------
I don't know where is the mistake. I think that it don't found libusb.a, so i copy that library to the same folder test1.
It works!!!!!!!!!!!!!!!!!
gcc -Wall -W -L/usr/lib/ -lusb prueba1.cpp -o prueba1
thanks keefaz!!!!
--------
but it has other errors:
/tmp/ccThZICU.o(.text+0x1b4): In function `__static_initialization_and_destruction_0(int, int)':
test1.cpp: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/ccThZICU.o(.text+0x1e3): In function `__tcf_0':
test1.cpp: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccThZICU.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
hello...
i installed busb-0.1.10a package.. i want to develop some simple applications with USB devices..
i execute the test programs... it executes fine...
now i copy the testfile testlibusb.c into another file name "testlib".. and try to compile it using the command
_______________________________________
gcc -Wall -W -L/usr/lib/ -lusb testlib.c -o testlib
but it gives some error...
_______________________________________
/tmp/ccME17sZ.o(.text+0x2db): In function `print_device':
: undefined reference to `usb_get_string_simple'
/tmp/ccME17sZ.o(.text+0x388): In function `print_device':
: undefined reference to `usb_get_string_simple'
/tmp/ccME17sZ.o(.text+0x522): In function `print_device':
: undefined reference to `usb_get_string_simple'
collect2: ld returned 1 exit status
kindly help me to compile that file... i think i might have used wrong commands...
hello...
i installed busb-0.1.10a package.. i want to develop some simple applications with USB devices..
i execute the test programs... it executes fine...
now i copy the testfile testlibusb.c into another file name "testlib".. and try to compile it using the command
_______________________________________
gcc -Wall -W -L/usr/lib/ -lusb testlib.c -o testlib
but it gives some error...
_______________________________________
/tmp/ccME17sZ.o(.text+0x2db): In function `print_device':
: undefined reference to `usb_get_string_simple'
/tmp/ccME17sZ.o(.text+0x388): In function `print_device':
: undefined reference to `usb_get_string_simple'
/tmp/ccME17sZ.o(.text+0x522): In function `print_device':
: undefined reference to `usb_get_string_simple'
collect2: ld returned 1 exit status
kindly help me to compile that file... i think i might have used wrong commands...
thanks in advance
manybe,you can try:
gcc -Wall testlib.c -o testlib ./libusb.a
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.