none
Unhandled exception at .... Access violation reading location ....

    Question

  • Hi experts,

         I have developed C++ win32 application which is using some lib files. when i call those lib function i often get some run time errors like

    Unhandled exception at 0x00c20b78 in Npptrail-Empty.exe: 0xC0000005: Access violation reading location 0x011f0240.

    any ideas?

    please help me to come over it...



    Thanks, Karguvel
    Tuesday, June 22, 2010 1:22 PM

Answers

  • Hi Karguvel,

    An access violation occurs when the code attempts to read or write to memory that has not been allocated, or to which it does not have access. This usually occurs because a pointer has a bad value. Not all reads or writes through bad pointers lead to access violations, so an access violation usually indicates that several reads or writes have occurred through bad pointers, and that memory might be corrupted. Thus, access violations almost always indicate serious programming errors.

    I agree with Igor and Scott that you should debug your code to find where the access violation happens. The article helps you indicate this problem: How Can I Debug an Access Violation?

    Anyway, would you mind letting us know the result of reinstalling the VS2008? Does it resolve the problem? 

    Cheers,

    Yi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, June 29, 2010 4:54 AM

All replies

  • Karguvel Rajan Ramachandran wrote:

    Hi experts,

    I have developed C++ win32 application which is using some lib files.  when i call those lib function i often get some run time
    errors like

    Unhandled exception at 0x00c20b78 in Npptrail-Empty.exe: 0xC0000005:  Access violation reading location 0x011f0240.

    any ideas?

    Most likely, you are passing incorrect parameters to said library  functions. Consider passing correct ones.


    Igor Tandetnik

    Tuesday, June 22, 2010 1:33 PM
  • Thank you Mr.Igor Tandetnik....

    I have tried the same project in some other pc. there it is working fine. So, I feel some problems with my Visual studio 2008 setup...could you help me to sort out it..


    Thanks, Karguvel
    Tuesday, June 22, 2010 1:39 PM
  • Build the project in the debug configuration and run it in the debugger.  When this type of error occurs the debugger will halt the program at the instruction that caused the error.  Then examine the debugger stack window to see the layers of calls that led to the problem.  Click in the stack window on lines that are part of your code and the calls and parameters that you passed can be examined.

     

    Tuesday, June 22, 2010 1:47 PM
  • Thank you Mr. Scott..

      But I don't think problems with my parameters. Because if problem with my parameters then it should show the same error.but it shows different unhandled exceptions(read violation, write violation) and some times executing with out any errors.

                        So I planned to reinstall my VS2008.


    Thanks, Karguvel
    Thursday, June 24, 2010 4:25 AM
  • Hi Karguvel,

    An access violation occurs when the code attempts to read or write to memory that has not been allocated, or to which it does not have access. This usually occurs because a pointer has a bad value. Not all reads or writes through bad pointers lead to access violations, so an access violation usually indicates that several reads or writes have occurred through bad pointers, and that memory might be corrupted. Thus, access violations almost always indicate serious programming errors.

    I agree with Igor and Scott that you should debug your code to find where the access violation happens. The article helps you indicate this problem: How Can I Debug an Access Violation?

    Anyway, would you mind letting us know the result of reinstalling the VS2008? Does it resolve the problem? 

    Cheers,

    Yi


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, June 29, 2010 4:54 AM
  • Thank you Mr.Yi Feng Li for your post...

    Sorry I didn't reinstall my VS2008.

    But i have solved that issue.Actually my lib functions wants the parameters should be stored in separate dedicated location. So I have to pass the pointers of the new locations as parameters.

    Before that i have passed the pointers of a old locations as parameter. So the lib functions gave access violation errors. So, Now i allocated a dedicated memory for my parameters and it is working fine. :)

     

    I should published it after solving my issue, but i forgot it. sorry..


    Thanks, Karguvel
    Tuesday, June 29, 2010 6:37 AM