Solved

Access violations...what? How to fix.

Posted on 1998-10-15
6
192 Views
Last Modified: 2010-04-02
Using...MS VC++ 5.0.  Batch programs that calls 2 c++ programs. The first call works fine, but the second gives an "access violation" error. What is this and what do I have to do to fix this?
0
Comment
Question by:wills1300
  • 4
6 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 70 total points
ID: 1175274
An access violation us ussually when a program attempts to access memory that it doesn't have permission to access.  This us ussaly caused by the program mistakely using a invalid pointer.  Thus it is attempting to access memory that it is allowed to, but because the pointer contains an invalid address, it is actually accessing memory that it is not allowed to.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1175275
Look over the code and look for places where it uses pointers and try to debug them.
Another common cause are strings that are not properly terminated.  A non-terminated string appears to go on for ever, thus it will appear to continue into memory that your porgram doesn't have access for.   So look for cases where you attempt to assemble strings and make sure you are terminating them.

Let me know if you have questions.
0
 

Author Comment

by:wills1300
ID: 1175276
I debugged the program, it then gives me this message:
1. c:\windows\systems\kernel32.dll, no matching symbolic  
   information found.
2. The thread 0xFFFC1327 has exited with code 1. (0x1).

Does this mean anything to you? What is #2 with 'thread 0xFFFC1327'? I use many pointers, how can I get to the 'bad' pointer.

thanks for you help.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 22

Expert Comment

by:nietod
ID: 1175277
first of all, make sure you are generating a debug version of your code.  Then make sure VC is running and you have just in time debugging enabled.  When the violation occurs, the debug should show you the line of code that caused the problem.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1175278
If that doesn't work, you may have to try to narrow in on the section of your progrm that is casuign the problem.  make it print out messages so that you can determine at what point it is dying.
0
 

Expert Comment

by:dpt081598
ID: 1175279
I get this sort of error once in a while and it is usually because I'm trying to do something with a control in a dialog box and the dialog box either hasn't been constructed yet or has been closed.  For example:

CMyDialogBox dlg;
dlg.m_member_variable = "foobar";  // setting a value is OK
if (dlg.DoModal() == IDOK)
     dlg.m_edit_control.SetFocus(); // error!

Even within CMyDialogBox I may sometimes try to do things with controls in PreCreateWindow that cause an error because the actual dialog box window isn't shown yet.

Experts--does this sound right?





0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now