Home
Dashboard
Directory
Help
Sign in
Microsoft
Connect
Your feedback improving Microsoft products
Search
Feedback
All Connect
Visual Studio and .NET Framework Home
Downloads
Feedback
Surveys
error C2259 cannot instantiate abstract class
by
fishks
Closed
as By Design
1
0
Sign in
to vote
Type:
Bug
ID:
101072
Opened:
9/17/2005 2:10:01 AM
Access Restriction:
Public
0
Workaround(s)
view
0
User(s) can reproduce this bug
when I compiler the file with vs2005,error happened.
but it's ok with vs2003 in command.
cl test.cpp
Details
(
expand
)
Product Language
English
Version
Visual Studio 2005 Release Candidate
Category
Language/Compiler
Operating System
Windows XP Professional
Operating System Language
Chinese (Simplified)
Steps to Reproduce
you can get the code in Attachments or download the code from http://download.microsoft.com/download/f/7/0/f704b47e-2de4-4f7d-adb9-e6306ca39237/SAX2Jumpstart.exe
Actual Results
F:\PSDK\复件 msxml\SAX2Jumpstart\te\abstract>cl test.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50215.44 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
test.cpp
test.cpp(342) : error C2259: 'MyContent' : cannot instantiate abstract class
due to following members:
'HRESULT MSXML2::ISAXContentHandler::startPrefixMapping(unsigned short *,int,unsig
ned short *,int)' : is abstract
f:\psdk\复件 msxml\sax2jumpstart\te\abstract\msxml4.tlh(499) : see declaration of
'MSXML2::ISAXContentHandler::startPrefixMapping'
'HRESULT MSXML2::ISAXContentHandler::ignorableWhitespace(unsigned short *,int)' :
is abstract
f:\psdk\复件 msxml\sax2jumpstart\te\abstract\msxml4.tlh(525) : see declaration of
'MSXML2::ISAXContentHandler::ignorableWhitespace'
'HRESULT MSXML2::ISAXContentHandler::processingInstruction(unsigned short *,int,un
signed short *,int)' : is abstract
f:\psdk\复件 msxml\sax2jumpstart\te\abstract\msxml4.tlh(528) : see declaration of
'MSXML2::ISAXContentHandler::processingInstruction'
.
.
.
'HRESULT MSXML2::ISAXContentHandler::skippedEntity(unsigned short *,int)' : is abs
tract
f:\psdk\复件 msxml\sax2jumpstart\te\abstract\msxml4.tlh(533) : see declaration of
'MSXML2::ISAXContentHandler::skippedEntity'
F:\PSDK\复件 msxml\SAX2Jumpstart\te\abstract>
Expected Results
as in vs2003:
F:\PSDK\复件 msxml\SAX2Jumpstart\te\abstract>cl test.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3052 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
test.cpp
Microsoft (R) Incremental Linker Version 7.10.3052
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
File Attachments
0 attachments
Comments (2)
Workarounds (0)
Sign in
to post a comment.
Please enter a comment.
Posted by
Microsoft
on 9/19/2005 at 10:06 AM
Thank you for providing a link to source code that reproduces the problem you are seeing. This behavior is by design with VS 2005. The root cause is because wchar_t is a different type than unsigned short though in prior versions of Visual C++, the compiler considered them to be the same type. In this sample code, the type library uses unsigned short but the C++ source files use wchar_t. So the types don't match therefore the functions that contain these types in their signatures don't override the interface.
To continue working with this sample, either correct the type mismatch or use the /Zc:wchar_t- compiler switch to force the compiler to consider wchar_t the same type as unsigned short.
In the VS 2005 project property properties, under the C/C++ node, select Language. Then change "Treat wchar_t as Built-In Type" from "Yes" to "No".
Shaun Miller
The Visual C++ Team
Posted by
Microsoft
on 9/19/2005 at 8:30 AM
Could you please attach a .zip file for a repro? An .exe was attached.
Thank you,
Dean Wills
Visual C++ Compiler Team
Sign in
to post a workaround.
Please enter a workaround.
© 2012 Microsoft Corporation. All rights reserved.
Microsoft Connect Terms of Use
|
Trademarks
|
Privacy Statement
Microsoft