How to Fix error C2105 ?
-
According the The file "Casting Difference Between C and C++ May Cause C2105" (please see http://support.microsoft.com/kb/q88434/#appliesto), We know the following code: void main() { char *p; ((long *)p)++; // If the file is saved as a .CPP, this } will be have error C2105 need l-value for c++. but for .c file is ok. Now I have very some problem (when i try to translate some codeing from c => c++ ). So how to fix the problem? func() { MIDL_STUB_MESSAGE _StubMsg; int __RPC_FAR *nCount; RPC_STATUS _Status; ... *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *nCount; ... } I got erro messsage for "*(( int __RPC_FAR * )_StubMsg.Buffer)++ = *nCount;" the message is "error C2105: '++' needs l-value" How to fix the problem? Thanks!!!
-
According the The file "Casting Difference Between C and C++ May Cause C2105" (please see http://support.microsoft.com/kb/q88434/#appliesto), We know the following code: void main() { char *p; ((long *)p)++; // If the file is saved as a .CPP, this } will be have error C2105 need l-value for c++. but for .c file is ok. Now I have very some problem (when i try to translate some codeing from c => c++ ). So how to fix the problem? func() { MIDL_STUB_MESSAGE _StubMsg; int __RPC_FAR *nCount; RPC_STATUS _Status; ... *(( int __RPC_FAR * )_StubMsg.Buffer)++ = *nCount; ... } I got erro messsage for "*(( int __RPC_FAR * )_StubMsg.Buffer)++ = *nCount;" the message is "error C2105: '++' needs l-value" How to fix the problem? Thanks!!!
rat.crown wrote:
*(( int __RPC_FAR * )_StubMsg.Buffer)++ = *nCount;
Replace above code with
*(( int __RPC_FAR * )_StubMsg->Buffer) = *nCount; _StubMsg->Buffer++;
- Nilesh "Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw