Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Need help installing software and header files

Thu Dec 27, 2012 8:51 pm

SOS. I tried to install eclipse and several libraries for C and python. Can't use eclipse for C++ nor the header files. I am complete newbie to Linux and Debian

User avatar
joan
Posts: 15038
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Need help installing software and header files

Thu Dec 27, 2012 8:58 pm

I know people use an IDE on the Pi but it must be a strange experience.

Try gcc from the command line.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Need help installing software and header files

Thu Dec 27, 2012 9:32 pm

but I will still need to put LIBusb in header file folder

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Need help installing software and header files

Thu Dec 27, 2012 9:46 pm

I also have installed several python modual libraries that I cannot use in IDLE for some reason. Even on my PC> These include PYserial and pyusb.

rgh
Posts: 212
Joined: Fri Nov 25, 2011 3:53 pm

Re: Need help installing software and header files

Thu Dec 27, 2012 10:24 pm

Patrick222122 wrote:but I will still need to put LIBusb in header file folder
Maybe this will help. Typically to develop C code on Linux using a particular library you need to install the development package for that library, which includes the header files describing the structures and functions you'll need to reference. For libusb, for example, that means you need to install libusb-dev, as follows:

Code: Select all

sudo apt-get install libusb-dev
Then you need to write some code that uses the library, for example:

Code: Select all


#include <stdio.h>
#include <usb.h>

int main(int argc, char **argv)
{
        struct usb_bus *busses;
        struct usb_bus *bus;
    
        usb_init();
        usb_find_busses();
        usb_find_devices();
    
        busses = usb_get_busses();

        for (bus = busses; bus; bus = bus->next) {
                struct usb_device *dev;
    
                printf("%s:\n", bus->dirname);
                for (dev = bus->devices; dev; dev = dev->next) {
                        printf("  %04x:%04x\n", dev->descriptor.idVendor,
                                                   dev->descriptor.idProduct);
                }
        }
        return 0;
}
Then you need to compile it and specify that it should link with libusb (I put the above code in a file called usb,c):

Code: Select all

gcc -Wall -g -o usb usb.c -lusb
And then you can run it:

Code: Select all

richard@raspberrypi ~/usb $ ./usb 
001:
  0bda:8176
  0424:ec00
  0424:9512
  1d6b:0002
richard@raspberrypi ~/usb $ 
You can compare the output with that from the lsusb command to check it makes sense.

Note some development packages put their header files in a subdirectory under /usr/include, and so then you'd need to specify an include path on the gcc command line too. libusb puts its header file, usb.h, directly in /usr/include so you do not need to specify a particular path. In some cases you can use pkg-config to generate the gcc arguments (search the forums for examples of that).

BTW, there are two versions of libusb, 0.1 and 1.0, so keep that in mind if you go looking at example code and documentation.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Need help installing software and header files

Thu Dec 27, 2012 10:30 pm

Thanks but I think I will stick with Python for programming my robot, less head pain programming python.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Need help installing software and header files

Mon Dec 31, 2012 11:11 pm

I tried to compile the program aboveand got the following error message:
usb.c: In function ‘main’:
usb.c:6:1: error: stray ‘\302’ in program
usb.c:6:1: error: stray ‘\240’ in program
usb.c:6:1: error: stray ‘\302’ in program
usb.c:6:1: error: stray ‘\240’ in program
usb.c:6:1: error: stray ‘\302’ in program
usb.c:6:1: error: stray ‘\240’ in program
usb.c:6:1: error: stray ‘\302’ in program
usb.c:6:1: error: stray ‘\240’ in program
usb.c:7:1: error: stray ‘\302’ in program
usb.c:7:1: error: stray ‘\240’ in program
usb.c:7:1: error: stray ‘\302’ in program
usb.c:7:1: error: stray ‘\240’ in program
usb.c:7:1: error: stray ‘\302’ in program
usb.c:7:1: error: stray ‘\240’ in program
usb.c:7:1: error: stray ‘\302’ in program
usb.c:7:1: error: stray ‘\240’ in program
usb.c:8:1: error: stray ‘\302’ in program
usb.c:8:1: error: stray ‘\240’ in program
usb.c:8:1: error: stray ‘\302’ in program
usb.c:8:1: error: stray ‘\240’ in program
usb.c:9:1: error: stray ‘\302’ in program
usb.c:9:1: error: stray ‘\240’ in program
usb.c:9:1: error: stray ‘\302’ in program
usb.c:9:1: error: stray ‘\240’ in program
usb.c:9:1: error: stray ‘\302’ in program
usb.c:9:1: error: stray ‘\240’ in program
usb.c:9:1: error: stray ‘\302’ in program
usb.c:9:1: error: stray ‘\240’ in program
usb.c:10:1: error: stray ‘\302’ in program
usb.c:10:1: error: stray ‘\240’ in program
usb.c:10:1: error: stray ‘\302’ in program
usb.c:10:1: error: stray ‘\240’ in program
usb.c:10:1: error: stray ‘\302’ in program
usb.c:10:1: error: stray ‘\240’ in program
usb.c:10:1: error: stray ‘\302’ in program
usb.c:10:1: error: stray ‘\240’ in program
usb.c:11:1: error: stray ‘\302’ in program
usb.c:11:1: error: stray ‘\240’ in program
usb.c:11:1: error: stray ‘\302’ in program
usb.c:11:1: error: stray ‘\240’ in program
usb.c:11:1: error: stray ‘\302’ in program
usb.c:11:1: error: stray ‘\240’ in program
usb.c:11:1: error: stray ‘\302’ in program
usb.c:11:1: error: stray ‘\240’ in program
usb.c:12:1: error: stray ‘\302’ in program
usb.c:12:1: error: stray ‘\240’ in program
usb.c:12:1: error: stray ‘\302’ in program
usb.c:12:1: error: stray ‘\240’ in program
usb.c:13:1: error: stray ‘\302’ in program
usb.c:13:1: error: stray ‘\240’ in program
usb.c:13:1: error: stray ‘\302’ in program
usb.c:13:1: error: stray ‘\240’ in program
usb.c:13:1: error: stray ‘\302’ in program
usb.c:13:1: error: stray ‘\240’ in program
usb.c:13:1: error: stray ‘\302’ in program
usb.c:13:1: error: stray ‘\240’ in program
usb.c:15:1: error: stray ‘\302’ in program
usb.c:15:1: error: stray ‘\240’ in program
usb.c:15:1: error: stray ‘\302’ in program
usb.c:15:1: error: stray ‘\240’ in program
usb.c:15:1: error: stray ‘\302’ in program
usb.c:15:1: error: stray ‘\240’ in program
usb.c:15:1: error: stray ‘\302’ in program
usb.c:15:1: error: stray ‘\240’ in program
usb.c:16:1: error: stray ‘\302’ in program
usb.c:16:1: error: stray ‘\240’ in program
usb.c:16:1: error: stray ‘\302’ in program
usb.c:16:1: error: stray ‘\240’ in program
usb.c:16:1: error: stray ‘\302’ in program
usb.c:16:1: error: stray ‘\240’ in program
usb.c:16:1: error: stray ‘\302’ in program
usb.c:16:1: error: stray ‘\240’ in program
usb.c:16:1: error: stray ‘\302’ in program
usb.c:16:1: error: stray ‘\240’ in program
usb.c:16:1: error: stray ‘\302’ in program
usb.c:16:1: error: stray ‘\240’ in program
usb.c:16:1: error: stray ‘\302’ in program
usb.c:16:1: error: stray ‘\240’ in program
usb.c:16:1: error: stray ‘\302’ in program
usb.c:16:1: error: stray ‘\240’ in program
usb.c:17:1: error: stray ‘\302’ in program
usb.c:17:1: error: stray ‘\240’ in program
usb.c:17:1: error: stray ‘\302’ in program
usb.c:17:1: error: stray ‘\240’ in program
usb.c:18:1: error: stray ‘\302’ in program
usb.c:18:1: error: stray ‘\240’ in program
usb.c:18:1: error: stray ‘\302’ in program
usb.c:18:1: error: stray ‘\240’ in program
usb.c:18:1: error: stray ‘\302’ in program
usb.c:18:1: error: stray ‘\240’ in program
usb.c:18:1: error: stray ‘\302’ in program
usb.c:18:1: error: stray ‘\240’ in program
usb.c:18:1: error: stray ‘\302’ in program
usb.c:18:1: error: stray ‘\240’ in program
usb.c:18:1: error: stray ‘\302’ in program
usb.c:18:1: error: stray ‘\240’ in program
usb.c:18:1: error: stray ‘\302’ in program
usb.c:18:1: error: stray ‘\240’ in program
usb.c:18:1: error: stray ‘\302’ in program
usb.c:18:1: error: stray ‘\240’ in program
usb.c:19:1: error: stray ‘\302’ in program
usb.c:19:1: error: stray ‘\240’ in program
usb.c:19:1: error: stray ‘\302’ in program
usb.c:19:1: error: stray ‘\240’ in program
usb.c:19:1: error: stray ‘\302’ in program
usb.c:19:1: error: stray ‘\240’ in program
usb.c:19:1: error: stray ‘\302’ in program
usb.c:19:1: error: stray ‘\240’ in program
usb.c:19:1: error: stray ‘\302’ in program
usb.c:19:1: error: stray ‘\240’ in program
usb.c:19:1: error: stray ‘\302’ in program
usb.c:19:1: error: stray ‘\240’ in program
usb.c:19:1: error: stray ‘\302’ in program
usb.c:19:1: error: stray ‘\240’ in program
usb.c:19:1: error: stray ‘\302’ in program
usb.c:19:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:20:1: error: stray ‘\302’ in program
usb.c:20:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:21:1: error: stray ‘\302’ in program
usb.c:21:1: error: stray ‘\240’ in program
usb.c:22:1: error: stray ‘\302’ in program
usb.c:22:1: error: stray ‘\240’ in program
usb.c:22:1: error: stray ‘\302’ in program
usb.c:22:1: error: stray ‘\240’ in program
usb.c:22:1: error: stray ‘\302’ in program
usb.c:22:1: error: stray ‘\240’ in program
usb.c:22:1: error: stray ‘\302’ in program
usb.c:22:1: error: stray ‘\240’ in program
usb.c:22:1: error: stray ‘\302’ in program
usb.c:22:1: error: stray ‘\240’ in program
usb.c:22:1: error: stray ‘\302’ in program
usb.c:22:1: error: stray ‘\240’ in program
usb.c:22:1: error: stray ‘\302’ in program
usb.c:22:1: error: stray ‘\240’ in program
usb.c:22:1: error: stray ‘\302’ in program
usb.c:22:1: error: stray ‘\240’ in program
usb.c:23:1: error: stray ‘\302’ in program
usb.c:23:1: error: stray ‘\240’ in program
usb.c:23:1: error: stray ‘\302’ in program
usb.c:23:1: error: stray ‘\240’ in program
usb.c:23:1: error: stray ‘\302’ in program
usb.c:23:1: error: stray ‘\240’ in program
usb.c:23:1: error: stray ‘\302’ in program
usb.c:23:1: error: stray ‘\240’ in program
usb.c:24:1: error: stray ‘\302’ in program
usb.c:24:1: error: stray ‘\240’ in program
usb.c:24:1: error: stray ‘\302’ in program
usb.c:24:1: error: stray ‘\240’ in program
usb.c:24:1: error: stray ‘\302’ in program
usb.c:24:1: error: stray ‘\240’ in program
usb.c:24:1: error: stray ‘\302’ in program
usb.c:24:1: error: stray ‘\240’ in program
I have absoloutly no idea what this means please help.

rgh
Posts: 212
Joined: Fri Nov 25, 2011 3:53 pm

Re: Need help installing software and header files

Tue Jan 01, 2013 8:18 am

That issue has cropped up a few times on the forum - try putting 'stray' in the search box :) See, for example, http://www.raspberrypi.org/phpBB3/viewt ... 33&t=25386, or http://www.raspberrypi.org/phpBB3/viewt ... 46#p204341. Basically when you cut and paste from the forum you can end up with something that looks like a space in your file but which isn't. In the first of those threads Joan gives a 'tr' command that will strip the bad characters, which is fine provided the white space isn't critical for correct functioning of the program.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Need help installing software and header files

Tue Jan 01, 2013 11:03 pm

well the code works now. I got a new problem. I need some help creating a test program for the connection between my pi and my propellor board. See my post in automation and robotics for information.

Return to “Debian”