libusb.h error; configuring ofxKinect with 0071 under Linux

I’m following the instructions for setting up ofxKinect and libfreenect on github. I can get the glview test to run from command line but can’t get the ofxKinect example to run through CodeBlocks. I get this:

  
  
fatal error: libusb.h: No such file or directory.  
  

But libusb is installed.

I found a much older post that recommended copying and pasting libusb into the ofxKinect folder. Tried that, no dice.

Any suggestions? What am I missing?

The problem is that the compiler doesn’t find the libusb header files. Try to add the folder where libusb.h resides to your config.make:

search the line with USER_CFLAGS and add libusb like in this example:

  
  
USER_CFLAGS = -I../path/to/libusb  
  

Thanks for your reply.

So when I add libusb to config.make it resolves that error but then produces the same for libfreenect-registration.h.
So I add that to config.make and it takes me back to the libusb error, even though it’s still declared in the config.make.

What’s next?

add multiple paths like that:

  
  
USER_CFLAGS = -I../path/to/libusb -I../path/to/somethingelse  
  

Thanks! That did it.

I now get:

  
  
ld||cannot find -llibopencv_legacy.a|  
ld||cannot find -llibopencv_haartraining_engine.a|  
ld||cannot find -llibopencv_calib3d.a|  
ld||cannot find -llibopencv_objdetect.a|  
ld||cannot find -llibopencv_features2d.a|  
ld||cannot find -llibopencv_imgproc.a|  
ld||cannot find -llibopencv_video.a|  
ld||cannot find -llibopencv_highgui.a|  
ld||cannot find -llibopencv_ml.a|  
ld||cannot find -llibopencv_legacy.a|  
ld||cannot find -llibopencv_core.a|  
ld||cannot find -llibopencv_flann.a|  
ld||cannot find -llibopencv_contrib.a|  
ld||cannot find -llibopencv_gpu.a|  
ld||cannot find -lusb1.0|  
  

Steps to correct it

  1. copy the** config.make, addons.make** and Makefile from example folder.

  2. maintain the folder structure as given below
    ( /apps/myapps/)

  3. update config.make as **USER_LDFLAGS = -lusb-1.0 **

Thanks for your reply.

I’m still getting the same errors, though. Previously I had the ofxKinect folder in addons/examples. I copied it to apps/myApps. But I receive the same errors either way.

Also, I already changed my config.make to: USER_LDFLAGS = -lusb-1.0. As with USER_CFLAGS, do I need to declare the entire path to -lusb-1.0?

Just to clarify your instructions:
When I copy config.make, etc., am I moving these or just making copies for when I make the update in step 3? Am I only putting the config.make, etc. files in or the entire ofxKinect folder?

Many thanks.

hi jarednielsen
Just paste this https://dl.dropbox.com/u/95080590/BasicExample.zip file in your app folder and let us know what error are you getting on compilation.

<of_root>/apps/yourappfolder/BasicExample

I got the

  
fatal error: ofxKinect.h: No such file or directory|  

error.

Add necessary addons in the addon folder and compile it. http://ofxaddons.com/ is the list of addons for of.

Alright, so now I’m getting this error on line 100 of libusb.h:

  
  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h||In function ‘uint16_t libusb_cpu_to_le16(uint16_t)’:|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|100|error: redefinition of ‘uint16_t libusb_cpu_to_le16(uint16_t)’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|118|error: ‘uint16_t libusb_cpu_to_le16(uint16_t)’ previously defined here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|125|error: multiple definition of ‘enum libusb_class_code’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|143|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|168|error: multiple definition of ‘enum libusb_descriptor_type’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|205|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|212|error: multiple definition of ‘enum libusb_endpoint_direction’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|249|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|226|error: multiple definition of ‘enum libusb_transfer_type’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|263|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|242|error: multiple definition of ‘enum libusb_standard_request’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|279|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|285|error: multiple definition of ‘enum libusb_request_type’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|322|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|303|error: multiple definition of ‘enum libusb_request_recipient’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|340|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|324|error: multiple definition of ‘enum libusb_iso_sync_type’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|361|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|345|error: multiple definition of ‘enum libusb_iso_usage_type’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|382|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|361|error: redefinition of ‘struct libusb_device_descriptor’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|398|error: previous definition of ‘struct libusb_device_descriptor’|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|415|error: redefinition of ‘struct libusb_endpoint_descriptor’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|452|error: previous definition of ‘struct libusb_endpoint_descriptor’|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|465|error: redefinition of ‘struct libusb_interface_descriptor’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|502|error: previous definition of ‘struct libusb_interface_descriptor’|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|513|error: redefinition of ‘struct libusb_interface’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|550|error: previous definition of ‘struct libusb_interface’|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|527|error: redefinition of ‘struct libusb_config_descriptor’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|564|error: previous definition of ‘struct libusb_config_descriptor’|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|570|error: redefinition of ‘struct libusb_control_setup’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|607|error: previous definition of ‘struct libusb_control_setup’|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|657|error: multiple definition of ‘enum libusb_error’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|714|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|706|error: multiple definition of ‘enum libusb_transfer_status’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|763|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|733|error: multiple definition of ‘enum libusb_transfer_flags’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|790|error: previous definition here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|749|error: redefinition of ‘struct libusb_iso_packet_descriptor’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|806|error: previous definition of ‘struct libusb_iso_packet_descriptor’|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|779|error: redefinition of ‘struct libusb_transfer’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|836|error: previous definition of ‘struct libusb_transfer’|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h||In function ‘unsigned char* libusb_control_transfer_get_data(libusb_transfer*)’:|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|909|error: redefinition of ‘unsigned char* libusb_control_transfer_get_data(libusb_transfer*)’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|978|error: ‘unsigned char* libusb_control_transfer_get_data(libusb_transfer*)’ previously defined here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h||In function ‘libusb_control_setup* libusb_control_transfer_get_setup(libusb_transfer*)’:|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|927|error: redefinition of ‘libusb_control_setup* libusb_control_transfer_get_setup(libusb_transfer*)’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|996|error: ‘libusb_control_setup* libusb_control_transfer_get_setup(libusb_transfer*)’ previously defined here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h||In function ‘void libusb_fill_control_setup(unsigned char*, uint8_t, uint8_t, uint16_t, uint16_t, uint16_t)’:|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|955|error: redefinition of ‘void libusb_fill_control_setup(unsigned char*, uint8_t, uint8_t, uint16_t, uint16_t, uint16_t)’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|1024|error: ‘void libusb_fill_control_setup(unsigned char*, uint8_t, uint8_t, uint16_t, uint16_t, uint16_t)’ previously defined here|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h||In function ‘void libusb_fill_control_transfer(libusb_transfer*, libusb_device_handle*, unsigned char*, libusb_transfer_cb_fn, void*, unsigned int)’:|  
../../../addons/ofxKinect/libs/libusb/osx/include/libusb-1.0/libusb.h|999|error: redefinition of ‘void libusb_fill_control_transfer(libusb_transfer*, libusb_device_handle*, unsigned char*, libusb_transfer_cb_fn, void*, unsigned int)’|  
../../../addons/ofxKinect/libs/libusb-1.0/libusb.h|1068|error: ‘void libusb_fill_control_transfer(libusb_transfer*, libusb_device_handle*, unsigned char*, libusb_transfer_cb_fn, void*, unsigned int)’ previously defined here|  
||More errors follow but not being shown.|  
||Edit the max errors limit in compiler options...|  
||=== Build finished: 50 errors, 0 warnings ===|  
  
  

is your OS 32 bit or 64 bit ?

regards,

I had the same problem but after several hours of review, I realized I had missed something really important.

The steps I made were:

  1. I opened the codeblocks (if already open, be sure to close all the workspace that was open.
  2. I opened a terminal and run the projectGenerator
  3. Select ofxOpenCV and ofxKinect
  4. create and open the project (to open in codeblocks)
  5. I closed the codeblocks (or at least the project that was generated)
  6. I went to the folder where you saved the project (/ apps / tu_carpeta)
  7. open the file that says config.make and add this line and save:
    # android specific, in case you want to use different optimizations
    USER_LIBS = -lusb-1.0
    USER_LIBS_ARM =
    USER_LIBS_ARM7 =
    USER_LIBS_NEON =
  8. Since the codeblocks open the project that was created.
  9. Go to the folder /addons/ofxKinect/example / src /
  10. main.cpp open, select all content, copy and paste it into the file of the same name within the codeblocks
  11. Repeat for the testApp.h and testApp.cpp
  12. is important that the copy and paste is made in the files from the codeblocks xq first I did not recognized me apart and I just went bone esuviese the application as if empty.
  13. save and compile
  14. I just came out warnings, run him out a window with 3 frames for the images …

Sorry for my english,


Saludos,

Yo tenia el mismo problema pero despues de varias horas de revisar, me di cuenta que habia omitido algo realmente importante.

Los pasos que hice fueron:

  1. Abrí el codeblocks (si ya esta abierto, asegurate de cerrar todo el workspace que estaba abierto.
  2. Abrí una terminal y ejecute el projectGenerator
  3. Seleccione ofxOpenCV y ofxKinect
  4. crear y abrir proyecto (para que se abra en codeblocks)
  5. cerré el codeblocks (o al menos el proyecto que se genero)
  6. me dirigí a la carpeta donde se guardo el proyecto (/apps/tu_carpeta)
  7. abra el archivo que dice config.make y agregue esta linea y guarde:
    # android specific, in case you want to use different optimizations
    USER_LIBS = -lusb-1.0
    USER_LIBS_ARM =
    USER_LIBS_ARM7 =
    USER_LIBS_NEON =
  8. Desde el codeblocks abra el proyecto que se creo.
  9. Vaya a la carpeta de addons/ofxKinect/example/src/
  10. abra main.cpp, seleccione todo el contenido, copie y peguelo en el archivo del mismo nombre dentro del codeblocks
  11. repita lo mismo para los testApp.h y testApp.cpp
  12. es importante que la copia y pegue se haga en los archivos desde el codeblocks xq primero yo lo hice aparte y no me reconocio osea solo me salio como si esuviese la aplicacion vacia.
  13. guarde y compile
  14. solo me salieron warnings, ejecute le sale una ventana con 3 cuadros para las imagenes…

64 bit.

Hi fzzio,
Thanks for the detailed response.
I went through your steps and still get the same error.

It appears I’m linking to the libusb in the osx folder.

How and where do I point Code::Blocks to the Linux-friendly libusb-1.0?

Thanks.

I do not know if the same thing happens to me, I do not use ubuntu linux, I’m using openSUSE. And because my case is timely, as I have a small problem, when I open codeblocks I do it from a terminal, like this:
$> Codeblocks

for if I double click the icon, or open it from the menu, I instance 2 times and gives me an error.

What release of oF you use?? I’m using the last (https://github.com/openframeworks/openFrameworks)

No se si te pase lo mismo que a mi, yo no uso ubuntu en linux sino openSuSe. Y debido a que mi caso es puntual, pues tengo un pequeño problema, cuando abro codeblocks debo hacerlo desde una terminal, así:
$> codeblocks

pues si doy doble click en el icono, o lo abro desde el menú, se me instancia 2 veces y me da error por eso.

Cual release de oF estas usando? yo uso la ultima (https://github.com/openframeworks/openFrameworks)

Me avisas, saludos

this sounds very much like a problem of codeblocks, not openframeworks. You’ll maybe find an answer at the C::B forum: http://forums.codeblocks.org/

hi jarednielsen
Have you installed libfreenect. If so, are you able to run the freenect-glview ?

https://github.com/OpenKinect/libfreenect