简体   繁体   中英

How to detect USRP usb type?

When i include uhd/usb_control.hpp in my main.cpp :

#include <uhd/transport/usb_control.hpp>

/* Some other includes */

int main (void)
{
    uhd::transport::usb_control::sptr usbSpeed;

    usbSpeed = uhd::transport::usb_control::make(handle, 0);
    /* `handle` is a `usb_device_handle::vid_pid_pair_t` */
}

I got error from here :

static sptr make(usb_device_handle::sptr handle, const int interface);

Error:
unexpected token struct. Did you forget a ';'
struct: missing tag name

And another strange error in:

usbSpeed = uhd::transport::usb_control::make(handle, 0);

Error:
Cannot convert argument 2 from int to const int

The only implementation that i find for uhd::transport::usb_control::make is uhd/transport/usb_dummy_impl.cpp which only throw an exception.

Environment information:
Compiler : MS Visual Studio 2017
OS : MS Windows 10
C++ Standard : 17

How to fix those errors ? I only what to detect the USRP usb type. For this i read the uhd source code and i find the uhd/transport/usb_control.hpp, But I have encountered those errors.

maybe the cause of this unexpected behavior is related to your included files and a conflict between some of them, as you mentioned in addition of #include <uhd/transport/usb_control.hpp> you have some other includes. i suggest move this include line upper and lower of other includes and test your code again.

wish my suggest be useful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM