Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
CString Meal::GetKitchenNote()
{
	try{
		return m_KitchenNote;
	 }
	catch(CString m_KitchenNote )
	{
		return CString("");
	}


I am using the above code, the program crashes, how to avoid this exception..

Am getting this exception: CXX0017: Error: symbol "m_KitchenNote?" not found
Posted

This is a compile time error. Make sure you spelt the variable name correctly and that it exists in the class definition for Meal.

Additionally, return m_KitchenNote; will not throw any exceptions, so there is no need for a try/catch here.
 
Share this answer
 
Comments
Gokulnath007 7-Nov-11 6:28am    
Unhandled exception at 0x78212c57 (mfc80d.dll) in ProNtr.exe: 0xC0000005: Access violation reading location 0x00000000. I am getting this exception and the green arrow points to the return m_KitchenNote; statement.
Andrew Brock 7-Nov-11 6:38am    
Try putting the try/catch back, but do it as Mehdi suggests.
I suspect, however that it is not really this function causing the issue, but it is how you are calling it.

Could you please update your question to include the few lines of code preceding the function call.

You can browse the call stack by going to Debug>Windows>Call Stack. Double click on a function in the list to go to it.
You should be using :
C++
...
catch(Exception *e)
{
}
...
 
Share this answer
 
Comments
Gokulnath007 7-Nov-11 6:34am    
I get some unknown values in m_KitchenNote as "Àk¥€l¥". How to avoid this??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900