Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:17:08+00:00 2026-05-26T03:17:08+00:00

I am trying to compile the example libusb.c provided by libusb package (if you

  • 0

I am trying to compile the example libusb.c provided by libusb package (if you dl the source code.)

It doesn’t work to say the least.

#include <stdio.h>
#include <sys/types.h>
#include <libusb/libusb.h>

That causes it to fail, there is no libusb/libusb.h it’s usb.h, so I change that. And it fails in new and innovative ways.

I’ve copied the file over, exactly, and named it example.c

I am using these commands and variations:

gcc -o example example.c -lusb -L /usr/lib/libusb.a
gcc -o example example.c -lusb -L /usr/lib/libusb.so

The errors I get when compiling are:

example.c:25: error: expected ‘)’ before ‘*’ token
example.c: In function ‘main’:
example.c:46: error: ‘libusb_device’ undeclared (first use in this function)
example.c:46: error: (Each undeclared identifier is reported only once
example.c:46: error: for each function it appears in.)
example.c:46: error: ‘devs’ undeclared (first use in this function)

Line 25: static void print_devs(libusb_device **devs)

Line 46: libusb_device **devs;

At first I followed a tutorial, and that failed to compile, in more or less the same ways, so I decided to just try the provided example, and that failed.

Can anyone help me out? Explain what I am doing wrong, cause I am lost on this one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:17:09+00:00Added an answer on May 26, 2026 at 3:17 am

    This is what I had to do on Debian. It should be at least similar in Ubuntu.

    Install libusb-1.0-0-dev

    Instead of:

    #include <libusb/libusb.h>
    

    do:

    #include <libusb.h>
    

    Compile with:

    gcc example.c `pkg-config --libs --cflags libusb-1.0`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to compile with Code::Blocks the example that comes up with GTK+: #include
i am trying to compile example source code which is using the OpenGL, SDL
I'm trying to compile the following simple DL library example code from Program-Library-HOWTO with
I am trying to compile the example code of Mahout in Action in Eclipse.
I'm trying to compile a block of example code using Thrust in an attempt
I'm trying to compile in Eclipse the example code from McDowell here JNA Keyboard
I'm trying to compile the message pack ( http://msgpack.org/ ) example code and keep
I am trying to compile example of Excel automation access from C++ code and
I'm trying to compile simple example to use the boost concept_check Code is as
I'm trying to compile example from Boost Gzip filters page: #include <fstream> #include <iostream>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.