Hi
I am using embedded visual C++ and new to it.
I have problem when I want to use try/catch. my try/catch code is as below:
try
{
m_oaItem.Add(pItem);
SetModifiedFlag();
m_iCurPosition = (m_oaItem.GetSize() - 1);
}
catch (CMemoryException* perr)
{
AfxMessageBox("Out of Memory", MB_ICONSTOP | MB_OK);
if (pItem)
{
delete pItem;
pItem = NULL;
}
perr->Delete();
}
When I build the application it give me error and warning as below:
C:\Documents and Settings\user1\My Documents\MobileInventory\MobileInventoryDoc.cpp(9 3) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify -GX
C:\Documents and Settings\user1\My Documents\MobileInventory\MobileInventoryDoc.cpp(1 00) : error C2665: 'AfxMessageBox' : none of the 2 overloads can convert parameter 1 from type 'char [14]'
I have tried solution below:
Project --> Settings... --> C/C++
Under "Category" Select C++ Language and check the "Enable exception handling". You can now do a rebuild all. You will prompted to save this project setting when you exit the IDE.
But I cannot find "Enable exception handling" option in the dialog in embedded Visual C++.
Can someone pls help, thanks in advance.
Best Regards
Edit/Delete Message