C++ Error
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: C++ Error

  1. #1
    Join Date
    Oct 2011
    Posts
    5

    Question C++ Error

    Hey guys. why am i getting this error?

    'System.AccessViolationException'

    it says im trying to write or read on protected memory

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,649

    Re: C++ Error

    Since that's what you do... Probably you use a bad pointer or some variable has been thrashed due to a buffer overflow or something similar.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  3. #3
    Join Date
    Oct 2011
    Posts
    5

    Re: C++ Error

    im creating an object. ive used to F10 thingy on debug with the lil red balls and all the values are ok, but then suddenly they all go to 0

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,649

    Re: C++ Error

    Then you probably overwrite those variables in some other code. Single step to the point where everything is ok and then set a data breakpoint on one of the variables that gets zeroed. Continue to run and the debugger will stop when it's accessed and reveal why it's happening.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


HTML5 Development Center