Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » Linking with usb library
Linking with usb library [message #10258] Thu, 28 June 2007 01:52 Go to next message
malaugh is currently offline  malaugh
Messages: 7
Registered: June 2007
Promising Member
Forgive my basic questions but I an a newbee at Linux programming and Ultimate++.

I am writing a program that communicates with a USB device. It uses the function usb_init(), usb_open() etc., which are contained in a library called libusb.a in the /usr/lib directory. I wrote a simple console program to test the libary interface

usb_init();
usb_find_busses();
usb_find_devices();
usb_busses = usb_get_busses();
for (bus = usb_busses; bus; bus = bus->next)
{
for (dev = bus->devices; dev; dev = dev->next)
{
printf("idVendor:0x%04x\n",dev->descriptor.idVendor);
printf("idProduct:0x%04x\n",dev-descriptor.idProduct);
}
}
return 0;

I can compile and run this program with the following gcc command:

gcc UsbList.cpp -lusb -lstdc++ -o UsbList

When I try to compile and run it under Ultimate++ I get
linker errors, it cannot find usb_init, usb_find_busses, usb_find_devices, or usb_get_busses.

How to I tell Ultimate++ to link with the usb library?

Thanks


Re: Linking with usb library [message #10263 is a reply to message #10258] Thu, 28 June 2007 09:20 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
malaugh wrote on Thu, 28 June 2007 01:52


How to I tell Ultimate++ to link with the usb library?



Hello,

in theide, menu item Setup/Build Method, right click in the panel "include" and "lib" to append a row with the path of the include and lib of your library.

Luigi
Re: Linking with usb library [message #10289 is a reply to message #10263] Sat, 30 June 2007 00:48 Go to previous messageGo to next message
malaugh is currently offline  malaugh
Messages: 7
Registered: June 2007
Promising Member
Thanks for you help. Actually my problem was I did not know how to include the library.

I found that adding the lines

When Libraries
GCC usb
GCC stdc++

in the package organizer solved my problem. I have a new problem though. I am trying to make a combined windows/linux program using the libusb library. The problem is windows requires the libusb.lib library, and linux the usb lib. This means I need to have something like

When Libaries
Windows libusb.lib
linux usb

The problem is both I use the GCC compiler on both linux and windows machines. Is there a way to use the "when" in this configuration?

Re: Linking with usb library [message #10293 is a reply to message #10289] Sat, 30 June 2007 12:11 Go to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
malaugh wrote on Sat, 30 June 2007 00:48


The problem is both I use the GCC compiler on both linux and windows machines. Is there a way to use the "when" in this configuration?



The two conditions to add in when library should be

GCC LINUX libusb.lib
GCC WIN32 usb

Luigi
Previous Topic: shared libraries for debug, static for release ?
Next Topic: How to predefine compiler wide macro from IDE?
Goto Forum:
  


Current Time: Sat Apr 27 21:46:47 CEST 2024

Total time taken to generate the page: 0.02707 seconds