全局变量
(1)usbtest.h里声明extern struct libusb_device_handle 星devh;
(2)usbtest.cpp里定义struct libusb_device_handle 星devh = NULL;
(3)thread1.cpp里加#include "usbtest.h"函数
局部变量
(1)usbtest.h里定义结构体类型
struct test_state {
libusb_device 星found;
libusb_context 星ctx;
libusb_device_handle 星handle;
int attached;
};
class UsbTest声明struct test_state state;
(2)thread1.h里class Thread1声明struct test_state 星m_state;
(3)usbtest.cpp里UsbTest的构造函数里加thread1.m_state = &state;get
qt4 与 qt5的区别:pro文件里有widgets的是qt5qt