Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

error C3646: 'exception' : unknown override specifier

2,582 views
Skip to first unread message

Morris Neuman

unread,
Jan 5, 2009, 11:15:01 PM1/5/09
to
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

David Lowndes

unread,
Jan 6, 2009, 4:32:19 AM1/6/09
to

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

Jialiang Ge [MSFT]

unread,
Jan 6, 2009, 4:30:43 AM1/6/09
to
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 (jia...@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:
msd...@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

Alex Blekhman

unread,
Jan 6, 2009, 6:40:13 AM1/6/09
to

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


Morris Neuman

unread,
Jan 6, 2009, 9:56:01 AM1/6/09
to
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

unread,
Jan 6, 2009, 10:14:24 AM1/6/09
to
"Morris Neuman" wrote:
> [...] 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?

I don't have VC++6.0 at hand to check it, but I douth that VS2008
automatically converts old VC++6.0 projects to managed C++/CLI
project. There should be a check box or something during upgrade
wizard that enables managed C++/CLI features.

> 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?

You should upgrade your project as managed if you have an
intention to interract with .NET assemblies etc from the C++ code.
Otherwise there is no any reason to make it managed. The upgrade
itself is pretty straightforward: follow the upgrade wizard, then
fix compilation errors.

However, the success of the whole process greately depends on the
health of original VC++6.0 project. I have seen very messy
projects that were unable to upgrade, VS upgrade wizard just
chocked in the process. In that case the common approach is to
create new empty project in VS2008 and add all old files and
settings one by one manually.

HTH
Alex


Morris Neuman

unread,
Jan 6, 2009, 11:00:01 AM1/6/09
to
I will try using the #include<exception>.
Where (what folder/file) do I see if VS2008 generated any error reports
in the upgrade wizard?
I can run the wizard again If I need to.

As you may see from my reply to Alex, I have a question on what is the best
way to upgrade a VS6.0 c++ project to use in VS2008 c++. How would I keep it
as native code? What are the implication of just keeping it as native code?
Can I keep the ported code as native and then as I develop new parts of the
program do that as managed code and have them both in the same project?

--
Thanks
Morris

Morris Neuman

unread,
Jan 6, 2009, 11:02:02 AM1/6/09
to
Dave
Thanks for your reply. I believe if you read the other replies they have
good reference articles and input on the issue that helped.
--
Thanks
Morris

Morris Neuman

unread,
Jan 7, 2009, 12:11:03 AM1/7/09
to
I tried your code change,
the include statement
#include <exception>
had no effect on the error.

The namespace directive
using namespace std;
did eliminate the problem. Maybe you can explain that?

--
Thanks
Morris

Jialiang Ge [MSFT]

unread,
Jan 7, 2009, 3:57:44 AM1/7/09
to
Hello Morris

I performed more researches on the subject and find that the root cause of
the issue is a break change of _STD_USING after VC6.

In VC6, when we include the header <exception>, the std namespace is
automatically used. We do not need to additionally add the line 'using
namespace std;'. The relevant code is:

In the file ..\VC98\Include\YVALS.H (the header is used by <exception>
indirectly)

#if defined(__cplusplus)
#define _STD std::
#define _STD_BEGIN namespace std {
#define _STD_END };
#define _STD_USING
#else
.....

The line #define _STD_USING indicates that, if the current project is a
C++ project, we define _STD_USING

However, after VC6, say in VC2008, std namespace is not used by default:

.\Microsoft Visual Studio 9.0\VC\include\yvals.h

#if defined(__cplusplus)
#define _STD_BEGIN namespace std {
#define _STD_END }
#define _STD ::std::

We need to manually add the line 'using namespace std;'.

It is this change that causes the error C3646: 'exception' : unknown
override specifier when we upgrade a VC6 project to VC2008. There is no
error in the upgrade, but the default setting in the different header files
causes the problem.

Please let me know whether this explanation answers your question?

Morris Neuman

unread,
Jan 7, 2009, 10:20:01 AM1/7/09
to
Yes that sound good.

Just two questions
1. Where on my system do I see the Upgrade Wizard log?

2. I tried to use Outlook express Mail reader to access this forum and get
the following error:
-------------
502 cv.net: Access denied to your node - ne...@cv.net

Configuration:
Account: MSDN
Server: news.optonline.net
Protocol: NNTP
Port: 119
Secure(SSL): 0
Error Number: 502
Code: 800ccca0
---------
I can access other forums like microsoft.public.dotnet.framework.aspnet
which also give that error but then go on to list all the postings. But this
vc.language forum does not display any postings.

Thanks again for your help

--
Thanks
Morris


""Jialiang Ge [MSFT]"" wrote:

> Hello Morris
>
> I performed more researches on the subject and find that the root cause of
> the issue is a break change of _STD_USING after VC6.
>
> In VC6, when we include the header <exception>, the std namespace is
> automatically used. We do not need to additionally add the line 'using
> namespace std;'. The relevant code is:
>
> In the file ..\VC98\Include\YVALS.H (the header is used by <exception>
> indirectly)
>
> #if defined(__cplusplus)
> #define _STD std::
> #define _STD_BEGIN namespace std {
> #define _STD_END };
> #define _STD_USING
> #else

> ......


>
> The line #define _STD_USING indicates that, if the current project is a
> C++ project, we define _STD_USING
>
> However, after VC6, say in VC2008, std namespace is not used by default:
>

> ..\Microsoft Visual Studio 9.0\VC\include\yvals.h

Igor Tandetnik

unread,
Jan 7, 2009, 10:24:03 AM1/7/09
to
Morris Neuman <Mor...@online.nospam> wrote:
> 2. I tried to use Outlook express Mail reader to access this forum
> and get the following error:
> -------------
> 502 cv.net: Access denied to your node - ne...@cv.net
>
> Configuration:
> Account: MSDN
> Server: news.optonline.net

Try subscribing directly to news.microsoft.com
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Morris Neuman

unread,
Jan 7, 2009, 1:37:01 PM1/7/09
to
Same results/error and no postings shown with news.microsoft.com
--
Thanks
Morris

Brian Muth

unread,
Jan 7, 2009, 2:25:02 PM1/7/09
to
That should be msnews.microsoft.com

Brian


Igor Tandetnik

unread,
Jan 7, 2009, 2:31:39 PM1/7/09
to
Brian Muth <bm...@mvps.org> wrote:
> That should be msnews.microsoft.com

Both news.microsoft.com and msnews.microsoft.com resolve to the same IP
address.

Jialiang Ge [MSFT]

unread,
Jan 8, 2009, 4:11:25 AM1/8/09
to
Hello Morris

>1. Where on my system do I see the Upgrade Wizard log?

I think I was wrong in this point. Upgrading a VC6 project to VC2005/2008
does not generate a log file. It just pops up the error message in a dialog
if any error occurs. You may want to have a look at this article:
http://msdn.microsoft.com/en-us/library/60z6y467(VS.80).aspx

2. I tried to use Outlook express Mail reader to access this forum and get

the following error: ...

The setup guide can be found at
http://www.microsoft.com/windows/ie/support/newsgroups/howto.mspx
Please follow its steps to configure your Outlook Express. Let me know if
you still get the error.

0 new messages