全局變量
(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