Click here to Skip to main content
15,885,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Folder Navigation Pin
David Crow29-Apr-09 4:24
David Crow29-Apr-09 4:24 
QuestionPath Check Pin
Davitor29-Apr-09 0:56
Davitor29-Apr-09 0:56 
AnswerRe: Path Check Pin
Rajesh R Subramanian29-Apr-09 1:01
professionalRajesh R Subramanian29-Apr-09 1:01 
AnswerRe: Path Check Pin
Davitor29-Apr-09 1:02
Davitor29-Apr-09 1:02 
AnswerRe: Path Check Pin
Jijo.Raj29-Apr-09 1:02
Jijo.Raj29-Apr-09 1:02 
AnswerRe: Path Check Pin
Hamid_RT29-Apr-09 4:38
Hamid_RT29-Apr-09 4:38 
AnswerRe: Path Check Pin
Joe Woodbury29-Apr-09 10:44
professionalJoe Woodbury29-Apr-09 10:44 
QuestionInitialize variable in static library [modified] Pin
samira forooghi29-Apr-09 0:13
samira forooghi29-Apr-09 0:13 
hi every one

I create a static library with visual c++ 6.0 App wizard.
I create a new generic class and declared my variables in its header file.
Then I initialized my variables in class constructor.

I want to use it in a new dialog based project, so I add related header file and write my library name in linker tab at project setting.

I create one object of this class in my function, But at the end of function when application exits from function occurs an exception.
I can't handle this exception.

Note : when I comment initialized this exception don’t happen.
Please help me

////////////////////////////////////////////////////////////////
// static library class (Test.h)
///////////////////////////////////////////////////////////////
class CTest  
{
public:
		
	CTest();
	virtual ~CTest();
	
	int		 m_i1;//or INT   
	int		 m_i2;   
	
        bool		 m_b1;//or BOOL
	bool		 m_b2;
	
	unsigned int	 m_ui1;//or DWORD32
	unsigned int	 m_ui2;
	
	unsigned short   m_us1;//or USHORT
	unsigned short   m_us2;
	
	BYTE		 m_bte1;//#include <windef.h> in stdafx.h for BYTE data type
	BYTE		 m_bte2;
	
	CString	 m_str1;//#include <afx.h> in stdafx.h for CString data type
	CString	 m_str2;	
};</afx.h></windef.h>


// (Test.cpp)
///////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Test.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CTest::CTest()
{
	
	m_i1=0;
	m_i2=0;  
		
	m_b1=true;
	m_b2=true;
		
	m_ui1=0;
	m_ui2=0;
		
	m_us1=1;
	m_us2=1;
		
	m_bte1=0;
	m_bte2=0;
		
	m_str1="";
	m_str2="";
		
}

CTest::~CTest()
{


}

////////////////////////////////////////////////////////////////
// My dialog base application
///////////////////////////////////////////////////////////////
void CUseTestLibDlg::OnBinitlib() 
{
	CTest  *pcTest=new CTest();

        delete pcTest;
	pcTest=NULL;
	
	
}// Unhandled exception in UseTestLib.exe: 0xC0000005: Access Violation.

void CUseTestLibDlg::OnBinitlib2() 
{
	CTest  pcTest;
	
}// Unhandled exception in UseTestLib.exe: 0xC0000005: Access Violation.


modified on Wednesday, April 29, 2009 6:26 AM

AnswerRe: Initialize variable in static library Pin
CPallini29-Apr-09 0:20
mveCPallini29-Apr-09 0:20 
GeneralRe: Initialize variable in static library Pin
samira forooghi29-Apr-09 0:30
samira forooghi29-Apr-09 0:30 
GeneralRe: Initialize variable in static library Pin
Stephen Hewitt29-Apr-09 0:30
Stephen Hewitt29-Apr-09 0:30 
GeneralRe: Initialize variable in static library Pin
Stuart Dootson29-Apr-09 0:36
professionalStuart Dootson29-Apr-09 0:36 
GeneralRe: Initialize variable in static library Pin
Maximilien29-Apr-09 0:43
Maximilien29-Apr-09 0:43 
GeneralRe: Initialize variable in static library Pin
Stuart Dootson29-Apr-09 0:46
professionalStuart Dootson29-Apr-09 0:46 
GeneralRe: Initialize variable in static library Pin
samira forooghi29-Apr-09 1:01
samira forooghi29-Apr-09 1:01 
GeneralRe: Initialize variable in static library Pin
Rajesh R Subramanian29-Apr-09 1:21
professionalRajesh R Subramanian29-Apr-09 1:21 
GeneralRe: Initialize variable in static library Pin
samira forooghi29-Apr-09 0:45
samira forooghi29-Apr-09 0:45 
AnswerRe: Initialize variable in static library Pin
Stuart Dootson29-Apr-09 0:45
professionalStuart Dootson29-Apr-09 0:45 
QuestionC++ / JNI object instance problems Pin
megaadam28-Apr-09 23:53
professionalmegaadam28-Apr-09 23:53 
Questioncreating menus dynamically Pin
Farhat Aisha28-Apr-09 23:33
Farhat Aisha28-Apr-09 23:33 
AnswerRe: creating menus dynamically Pin
led mike29-Apr-09 4:21
led mike29-Apr-09 4:21 
QuestionClear X-Box from the system menu Pin
Shashi.Shinde28-Apr-09 23:24
Shashi.Shinde28-Apr-09 23:24 
AnswerRe: Clear X-Box from the system menu Pin
Stuart Dootson29-Apr-09 0:22
professionalStuart Dootson29-Apr-09 0:22 
AnswerRe: Clear X-Box from the system menu Pin
David Crow29-Apr-09 4:34
David Crow29-Apr-09 4:34 
Question[Message Deleted] Pin
Purish Dwivedi28-Apr-09 23:03
Purish Dwivedi28-Apr-09 23:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.