[Insight-users] Please help with access violation error!!! (partly solved)

Luis Ibanez luis.ibanez at kitware.com
Sun Mar 6 10:32:07 EST 2005

Hi Nicolaus,

1) If you compile your application *AND* all the
    shared libraries on Debug mode, you should be
    able to run the application in Debug mode from
    the VisualStudio environment and identify the
    exact place where the exception is thrown.

    Make sure that in Visual Studio you enable the
    option of "break on exceptions".

    In VisualStudio 7.1 This is done by

     1) Going to the "Debug" menu in the top menu bar

     2) Selecting "Exceptions..." ( a new window will pop up)

     3) In the frame "When the exception is thrown" select
        "Break into the debugger"

     4) In the frame "If the exception is not handled" select
        "Break into the debugger"

     Note that this selections can be set Exception-type by
     Exception-type. You can target the specific exception
     that you are getting:

                "OxC000005: Access violation"

     You will find it in the group:

                   "Win32 Exceptions"

      in my installation it is the fourth on that list.

      If you click on that exception in the Debug/Exceptions
      window, you can select explicitly to "Break into the
      debugger" when the exception is thrown.

2) You may want to try using a catch-all try/catch
    block. This is done using the symbol "..." in
    the catch statement, like

      catch( std::exception & excp )
       std::cerr << "C++ generic exception catched" << std::endl;
       std::cerr << "It says : " << excp.what() << std::endl;
      catch( ... )
       std::cerr << "Error message here" << std::endl;

for the particular problem that you are facing,
option (1) is probably a better path to follow.

Please let us know what you find.



Nicolaus Andratschke wrote:

> On WinXP, I was able to "work" around the memory
> access violation by recompiling everything with shared
> libs option turned off. Obviously, the êrror occurs,
> when dynamically linked libraries.
> As I am new to C++ (I intend to use VTK and ITK with
> python scripting) I have the following questions:
> 1) How can I debug the dynamically linked program in
> order to see where the error occurs exactly?
> 2) How can I get a more meaningful error message
> (other than this windows dialog box), because this
> exception is obviously not caught by the programs
> try/catch statement?
> Thanks,
> --- Nicolaus Andratschke <koegli at yahoo.com> wrote:
>>Date: Thu, 3 Mar 2005 12:42:29 -0800 (PST)
>>From: Nicolaus Andratschke <koegli at yahoo.com>
>>Subject: Please help with access violation error!!!
>>To: insight-users at itk.org
>>for several weeks now, I"m trying to get ITK
>>working (ImageReadWrite.exe,
>>I even asked the list, but so far I haven"t received
>>any response.
>>The problem is the following:
>>Everything compiles fine (bcc5.5.1, VC6, free
>>VC++Toolkit on WinXP; gcc 3.3.4 on Ubuntu Linux).
>>But when I run the above mentioned example programs
>>with the appropriate test images, I get "memory
>>violation" error. 
>>E.g., on WinXP a dialog box pops up telling
>>"DicomImageReadWrite.exe encountered a problem and
>>needs to close" and another one telling "unhandled
>>exception OxC000005: Access violation". 
>>The error obviously happens when "writer->Update()"
>>called and the pipeline gets updated. Interestingly,
>>this function gets called inside a try/catch block
>>without the exception getting caught. There is no
>>error message that"s written on the command line
>>I urgently need help with this, otherwise I need to
>>give up on ITK.
>>Perhaps somebody could help me how to produce a
>>meaningful error message.
>>Any help is very much appreciated.
>>Celebrate Yahoo!'s 10th Birthday! 
>>Yahoo! Netrospective: 100 Moments of the Web 
> __________________________________ 
> Celebrate Yahoo!'s 10th Birthday! 
> Yahoo! Netrospective: 100 Moments of the Web 
> http://birthday.yahoo.com/netrospective/
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users

More information about the Insight-users mailing list