Access Violation.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • UnknownBlue
    New Member
    • Jan 2007
    • 14

    Access Violation.

    Hi.

    I have this error after I run VC6 program; "First-chance exception in CV_13.exe (NTDLL.DLL): 0xC0000005: Access Violation."

    I have this error after I add a member variable to a class. If I do not add this member variable, the program works fine.

    What does this error means? And how can I fix it?
    Thanks.
  • vermarajeev
    New Member
    • Aug 2006
    • 180

    #2
    Originally posted by UnknownBlue
    Hi.

    I have this error after I run VC6 program; "First-chance exception in CV_13.exe (NTDLL.DLL): 0xC0000005: Access Violation."

    I have this error after I add a member variable to a class. If I do not add this member variable, the program works fine.

    What does this error means? And how can I fix it?
    Thanks.
    Error 0xC0000005 (Access Violation) is a very generic error and is application specific.
    Can you provide some code that you have written????

    Comment

    • UnknownBlue
      New Member
      • Jan 2007
      • 14

      #3
      Hi.

      I have a program which is able to run. But when I add a member variable, int m_factor, through Classview, I cant run the program anymore. And if I delete int m_factor, it works again! I dont know why I cant add member variable.

      Comment

      • svlsr2000
        Recognized Expert New Member
        • Feb 2007
        • 181

        #4


        gives a general introduction about this error. can u post the code for classView and where your adding the variable.

        Comment

        • arunmib
          New Member
          • May 2007
          • 104

          #5
          In short or to brief it up, the new variable you are adding might be trying to access some memory location which is not in your program's scope or doing something which makes some other variable to access beyond your program's scope.

          Thats all I can say with the data you have provided.

          Comment

          • UnknownBlue
            New Member
            • Jan 2007
            • 14

            #6
            Originally posted by svlsr2000
            can u post the code for classView and where your adding the variable.
            Code:
            class CCVPlot : public CStatic
            {
            // Construction
            public:
            	CCVPlot();
            
            // Attributes
            public:
            
            // Operations
            public:
            
            // Overrides
            	// ClassWizard generated virtual function overrides
            	//{{AFX_VIRTUAL(CCVPlot)
            	//}}AFX_VIRTUAL
            
            // Implementation
            public:
            	int m_factor;
            	int m_colour;
            	int m_blackRect;
            	int m_iY2;
            	int m_iY1;
            	int m_iX2;
            	int m_iX1;
            	CRect m_recto;
            	int m_onDraw;
            	int m_xEnd;
            	int m_xBegin;
            	int m_graph;
            	short m_xAxis[10240];
            	short m_yAxis[10240];
            	virtual ~CCVPlot();
            
            	// Generated message map functions
            protected:
            	//{{AFX_MSG(CCVPlot)
            	afx_msg void OnPaint();
            	//}}AFX_MSG
            
            	DECLARE_MESSAGE_MAP()
            private:
            	void WithDelay(CDC &dc);
            };
            the variable is added to a class that I have created with base class CStatic.

            Comment

            • AdrianH
              Recognized Expert Top Contributor
              • Feb 2007
              • 1251

              #7
              Originally posted by UnknownBlue
              Code:
              class CCVPlot : public CStatic
              {
              // Construction
              public:
              	CCVPlot();
              
              // Attributes
              public:
              
              // Operations
              public:
              
              // Overrides
              	// ClassWizard generated virtual function overrides
              	//{{AFX_VIRTUAL(CCVPlot)
              	//}}AFX_VIRTUAL
              
              // Implementation
              public:
              	int m_factor;
              	int m_colour;
              	int m_blackRect;
              	int m_iY2;
              	int m_iY1;
              	int m_iX2;
              	int m_iX1;
              	CRect m_recto;
              	int m_onDraw;
              	int m_xEnd;
              	int m_xBegin;
              	int m_graph;
              	short m_xAxis[10240];
              	short m_yAxis[10240];
              	virtual ~CCVPlot();
              
              	// Generated message map functions
              protected:
              	//{{AFX_MSG(CCVPlot)
              	afx_msg void OnPaint();
              	//}}AFX_MSG
              
              	DECLARE_MESSAGE_MAP()
              private:
              	void WithDelay(CDC &dc);
              };
              the variable is added to a class that I have created with base class CStatic.
              Try doing a clean rebuild, not an incrimental rebuild. What appears to be happening is you have some sort of phase error where parts of the code have old definitions of the class and are accessing it inappropriately because of this.


              Adrian

              Comment

              • UnknownBlue
                New Member
                • Jan 2007
                • 14

                #8
                Originally posted by AdrianH
                Try doing a clean rebuild, not an incrimental rebuild. What appears to be happening is you have some sort of phase error where parts of the code have old definitions of the class and are accessing it inappropriately because of this.


                Adrian

                It works! Thanks a lot!

                Comment

                • AdrianH
                  Recognized Expert Top Contributor
                  • Feb 2007
                  • 1251

                  #9
                  Originally posted by UnknownBlue
                  It works! Thanks a lot!
                  Glad to help.


                  Adrian

                  Comment

                  Working...