libusb compile error
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. |
I found the error. It was that gcc can't find functions in libusb.a because it was compiled with ansi c.
someone know how can i do to compile it. |
Try :
Code:
gcc -Wall -W test1.cpp -o test1 -lusb |
it doesn work. I want to try with libusb.so, but I don't know how to write it.
|
Quote:
Code:
-lusb |
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 |
Try
Code:
g++ -Wall -W prueba1.cpp -o prueba1 -L/usr/lib/ -lusb |
it works!!!!!!!!! thak you!!!!
I don't understand which is the diference between gcc and g++. I read http://gcc.gnu.org/onlinedocs/gcc-4...._Keyword-Index but this is a lot of information together. Do you know other site that explain compilation options? |
gcc is a C compiler, g++ is a C++ compiler
|
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 |
Quote:
gcc -Wall testlib.c -o testlib ./libusb.a |
All times are GMT -5. The time now is 07:53 AM. |