ココア プロジェクトにUSBPrivateDataSampleを実装しようとしています。問題は、構造体 MyPrivateData にメモリを割り当てようとしているときにエラーが発生することです
「互換性のないタイプ 'void *' から "MyPrivateData *" に代入しています」
ヘッダー ファイルに構造体定義があります。
#define kMyVendorID 0x0403
#define kMyProductID 0x6001
class RtMidiOut;
typedef struct MyPrivateData {
io_object_t notification;
IOUSBDeviceInterface **deviceInterface;
CFStringRef deviceName;
UInt32 locationID;
} MyPrivateData;
static IONotificationPortRef gNotifyPort;
static io_iterator_t gAddedIter;
static CFRunLoopRef gRunLoop;
@interface serialInput : NSObject{
...
そして、私は自分の .mm ファイルを呼び出しています:
void DeviceAdded(void *refCon, io_iterator_t iterator){
kern_return_t kr;
io_service_t usbDevice;
IOCFPlugInInterface **plugInInterface = NULL;
SInt32 score;
HRESULT res;
while ((usbDevice = IOIteratorNext(iterator))) {
io_name_t deviceName;
CFStringRef deviceNameAsCFString;
MyPrivateData *privateDataRef;
UInt32 locationID;
printf("Device added.\n");
// Add some app-specific information about this device.
// Create a buffer to hold the data.
privateDataRef = malloc(sizeof(MyPrivateData)); //The error!
bzero(privateDataRef, sizeof(MyPrivateData));
役に立つアドバイスはありますか?