when using unmanaged class with my managed app, I've seen errors when
including (for example) <windows.h>.
One of theses erros is :
IDataObject : ambiguous symbol error
I've seen somewhere that to avoid this error, i've to remove all "using
namespace XXXXX" from .h, and move it to .cpp.
This is working ... but, i would like to know why such an error ?
Thanks in advance for any explanation
Best,
Nicolas H.
Okay, here goes :)I've been burying some hours trying to get an existing C dll (using __cdeclcalling...
By theunprofessional
When I try to sort my combo box I get the following error."Cannot sort a ComboBox that has a DataSou...
By raj
hi all i m doing aproject i visual C++ on image processing. i wan to extract the r g b colorof the ...
By vinnu
hi please help me to find the color of an image . i am doing a project on image processing . iam usi...
By vinnu
I am not very fluent with computers, but I just got a new system withWin XP Pro x64 and it works gre...
By joejrk, 1 Comments
HI,I am converting VC++ 6.0 to .NET 2003. But I am getting linker error.Error:MyApplication fatal er...
By durga, 1 Comments
Hello,Until 6 years ago I was a C++ programmer. The last 6 years I've donesomething else than comput...
By bas, 4 Comments
Does VC7.1 support hyperthreading?I looked in the documentation but I could find no reference at all...
By andrewmaclean, 8 Comments
VS.NET 2003 V7.1.3088 - Unmanaged codeI'm getting:c:\Proj\pt.h(581) : fatal error C1001: INTERNAL CO...
By drew, 2 Comments
<nicolas.hilaire...motorola.com> wrote
> when using unmanaged class with my managed app, I've seen errors when
> including (for example) <windows.h>.
> One of theses erros is :
> IDataObject : ambiguous symbol error
> I've seen somewhere that to avoid this error, i've to remove all "using
> namespace XXXXX" from .h, and move it to .cpp.
> This is working ... but, i would like to know why such an error ?
Several distinct entities (probably types) named IDataObject
from different scopes have been introduced into the current
scope.
Windows Shell declares an IDataObject as a native
interface (=struct), the base class library has several
definitions of IDataObject as a managed interface.
All these types are different. When you say
using namespace System::Windows::Forms
IDataObject could refer to
the IDataObject in the global scope (from objidl.h) or to
System::Windows::Forms::IDataObject.
You can use qualified names to refer to the entity.
For instance,
::IDataObject // the one in the global scope
System::Windows::Forms::IDataObject // the other one
Windows::Forms::DataObject // same as above, assumes
// using namespace System
-hg
holgergrund | Wed, 02 Jan 2008 19:18:00 GMT |
i never use IDataObject for myself, but maybe it's used elsewhere
But i can't understand why moving the references to the cpp files can
solve this error ...
nicolas_hilaire_motorola_com | Wed, 02 Jan 2008 19:19:00 GMT |
<nicolas.hilaire...motorola.com> wrote
>i never use IDataObject for myself, but maybe it's used elsewhere
> But i can't understand why moving the references to the cpp files can
> solve this error ...
C and C++ are one-pass models. The compiler only considers
the using directives that have already been seen.
E.g.:
class A{};
namespace B { class A{}; }
typedef A T; // OK
using namespace B;
typedef A U; // error ::A or ::B::A ?
Since you say, you don't use IDataObject yourself and
moving the directives to the .cpp makes things work
again, I'd guess there's some header that references
IDataObject, introducing the ambiguity.
You should see where the error occurs by looking
at the diagnostics (/showIncludes or preprocessing
gives you additional information if you can't directly
deduce the inclusion chain)
Had you placed the using directives at the top of
your .cpp file
namespace System { namespace Windows { namespace Forms {
}}}
using namespace System::Windows::Forms
#include ...
you would have probably got the same errors.
-hg
holgergrund | Wed, 02 Jan 2008 19:20:00 GMT |