我在此声明中遇到两个错误。
request->memset(st.uReserved,0x00,sizeof(st.uReserved));
Error1:Expected identifier before '(' token
请求是另一个类的对象。
#define DECLARE_RS232_NEWMSG(ClassID)\
enum \
{ \
ID = ClassID \
}; \
@interface requestSession : data {
@public
DECLARE_RS232_NEWMSG(RM_REQUEST_SESSION); //Error2:Declaration does not declare anything
struct RMH_REQUEST_SESSION_MSG st;
}
dataSession.m
-------------
- (id)init
{
request->st.uDeviceID = RS232_PROTOCOL_DEVICE_ID;
request->st.uProtocolVersion = RS232_VERSION;
memset(request->st.uReserved,0x00,sizeof(request->st.uReserved));
return self;
}
remote.h
--------
struct RMH_REQUEST_SESSION_MSG //Message Data
{
int uDeviceID;
int uProtocolVersion;
int uReserved[5];
};
data_derived.h
--------------
@interface requestSession : data {
@public
DECLARE_RS232_NEWMSG(RM_REQUEST_SESSION);
struct RMH_REQUEST_SESSION_MSG st;
}
@end
dataSession.h
-------------
@interface dataSession : NSObject {
requestSession* request;
}
@end