473,320 Members | 2,161 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Warning C4530: C++ exception handler used, but unwind semantics are not enabled

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
Apr 27 '06 #1
2 25242
after 1 days struggled finally get the solution as below:

---------------------------------------------------------------------------

Windows CE 3.0 and earlier (versions targetted by eVC 3.0) do not support
C++ SEH, so you cannot use try/catch (and thus specifying -GX wouldn't help
you). You can use C exception handling (try/except), however.

For Windows CE 4.0 and later (use eVC 4.0 for those targets), it depends on
the actual Windows CE configuration if C++ SEH is supported. If it is, you
can use try/catch, but you do have to manually add -GX to the compiler
command line. You do so by clicking the Project\Settings... menu item in
eVC, select the C/C++ tab, and then go into the edit box at the bottom of
that dialog where the command line is and adding "-GX".

---------------------------------------------------------------------------

Or you can view solution at:
http://www.tech-archive.net/Archive/...4-03/0372.html

Regards
Apr 28 '06 #2
after 1 days struggled finally get the solution as below:

---------------------------------------------------------------------------

Windows CE 3.0 and earlier (versions targetted by eVC 3.0) do not support
C++ SEH, so you cannot use try/catch (and thus specifying -GX wouldn't help
you). You can use C exception handling (try/except), however.

For Windows CE 4.0 and later (use eVC 4.0 for those targets), it depends on
the actual Windows CE configuration if C++ SEH is supported. If it is, you
can use try/catch, but you do have to manually add -GX to the compiler
command line. You do so by clicking the Project\Settings... menu item in
eVC, select the C/C++ tab, and then go into the edit box at the bottom of
that dialog where the command line is and adding "-GX".

---------------------------------------------------------------------------

Or you can view solution at:
http://www.tech-archive.net/Archive/...4-03/0372.html

Regards
After adding "-GX" in command line, and then Rebuild All.
Apr 28 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Ritz, Bruno | last post by:
hi in java i found that when a method has a throws clause in the definition, callers must either handle the exceptions thrown by the method they are calling or "forward" the exception to the...
9
by: Kevin Goodsell | last post by:
If I'm writing a class that will be used as an exception, what kinds of things do I need to watch out for? For example, is it necessary to make sure that the members of the class don't throw? ...
1
by: Todd A. Anderson | last post by:
Hi, I want to call VirtualProtect with the PAGE_GUARD flag to cause subsequent accesses to certain regions of memory to generate the STATUS_GUARD_PAGE exception. When this exception happens, I...
3
by: Tony Johansson | last post by:
Hello! When you allocate object dynamically which mean on the heap I find that a problem when using exception. What is the prefer method to handle this kind of problem. //Tony
5
by: juergen perlinger | last post by:
Hello out there. sometimes I need to have proper control of the floating point arithmetic of the C(and C++) runtime system, and using the f.p. exception handling of the C99 standard is quite...
27
by: v4vijayakumar | last post by:
what "enabling unwind semantics" occording to Microsoft (R) 32-bit C/C++ Optimizing Compiler. C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\ostream(574) : warnin g C4530: C++...
15
by: Mark Lewis | last post by:
I have a weird error trapping problem. When running the IDE everything works fine but not when running in an EXE I get the Unhandled Exception Error message box intead of the one in my Try....Catch...
1
by: George2 | last post by:
Hello everyone, Such code segment is used to check whether function call or exception- handling mechanism runs out of memory first (written by Bjarne), void perverted() { try{
12
by: Fabiano Sidler | last post by:
Hi folks! I'm using gcc 4.2.3 and glibc6 2.7. I'm doing an exception handling implementation for a library. Although I assume to have it done properly, with a handler set up, it exits the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.