Prev: Broken code when compiled with SDK 6.1
Next: CString
From: Morris Neuman on 5 Jan 2009 23:15 The following function declaration of a pure virtual funtion from a C++ VS6.0 project that I am porting to vs2008 C++: virtual PostExecAction Execute() throw(exception) = 0; generates the following error C3646: 'exception' : unknown override specifier. What is the proper format for the declaration in VS2008 C++? -- Thanks Morris
From: "Jialiang Ge [MSFT]" on 6 Jan 2009 04:30 Hello Morris The compiler cannot find the declaration of the class 'exception', thus it generates the error C3646: 'exception' : unknown override specifier. According to the MSDN article http://msdn.microsoft.com/en-us/library/c4ts6d5a.aspx, using the 'exception' class requires the header file <exception> and the namespace std. Please check whether you have these two things in the file. #include <exception> using namespace std; The code compiled well in VC6.0. The problem might be caused by the process of upgrade. Please check whether or not VS2008 generated any error reports in the upgrade wizard. Comparing the source code before and after the upgrade may also help us figure out why the two requirements of 'exception' are lost. Regards, Jialiang Ge (jialge(a)online.microsoft.com, remove 'online.') Microsoft Online Community Support ================================================= Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg(a)microsoft.com. This posting is provided "AS IS" with no warranties, and confers no rights. =================================================
From: David Lowndes on 6 Jan 2009 04:32 >The following function declaration of a pure virtual funtion from a C++ VS6.0 >project that I am porting to vs2008 C++: > > virtual PostExecAction Execute() throw(exception) = 0; > >generates the following > > error C3646: 'exception' : unknown override specifier. > >What is the proper format for the declaration in VS2008 C++? The format looks correct, but for some reason "exception" is unknown. If you change it temporarily to int see if that eliminates that particular error. Dave
From: Alex Blekhman on 6 Jan 2009 06:40 "Morris Neuman" wrote: > The following function declaration of a pure virtual funtion > from a C++ VS6.0 project that I am porting to vs2008 C++: > > virtual PostExecAction Execute() throw(exception) = 0; > > generates the following > > error C3646: 'exception' : unknown override specifier. > > What is the proper format for the declaration in VS2008 C++? It seems that you have made managed (.NET CLR) C++ project in VC++ 2008 as opposite to native C++ project. The error C3646 relates to CLR features. However, putting the CLR issue aside, I'd suggest you to drop exception specifications altogether. VC++ doesn't support exception specifications except for one special case: throw(), i.e. empty exception specification. For more info about exception specifications read here: "A Pragmatic Look at Exception Specifications" http://www.gotw.ca/publications/mill22.htm HTH Alex
From: Morris Neuman on 6 Jan 2009 09:56
Alex Thank you for your help. You touched on the issue I have a question about which is how do I just migrate the vs6.0 c++ project to a vs2008 native c++ vs the managed code the compiler automatically upgraded the project to? Is keeping the project in native c++ the easiest way to move my project to vs2008 from vs6.0? Or is the managed code the way to go? -- Thanks Morris "Alex Blekhman" wrote: > "Morris Neuman" wrote: > > The following function declaration of a pure virtual funtion > > from a C++ VS6.0 project that I am porting to vs2008 C++: > > > > virtual PostExecAction Execute() throw(exception) = 0; > > > > generates the following > > > > error C3646: 'exception' : unknown override specifier. > > > > What is the proper format for the declaration in VS2008 C++? > > It seems that you have made managed (.NET CLR) C++ project in VC++ > 2008 as opposite to native C++ project. The error C3646 relates to > CLR features. > > However, putting the CLR issue aside, I'd suggest you to drop > exception specifications altogether. VC++ doesn't support > exception specifications except for one special case: throw(), > i.e. empty exception specification. For more info about exception > specifications read here: > > "A Pragmatic Look at Exception Specifications" > http://www.gotw.ca/publications/mill22.htm > > HTH > Alex > > > |