Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Fix error C2105 ?

How to Fix error C2105 ?

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comtutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rat crown
    wrote on last edited by
    #1

    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!!!

    N 1 Reply Last reply
    0
    • R rat crown

      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!!!

      N Offline
      N Offline
      Nilesh K
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups