-
February 1st, 2006, 02:52 PM
#1
What can I do to use wtypes without internal errors?
I have a project that uses legacy code C++ with lots of references to the file wtypes.h. Basically this use the function wsprintf and PALETTEENTRY. If I include this file I get the error C2872 in compile time:
error C2872: 'IServiceProvider' : ambiguous symbol
could be '\Vc7\PlatformSDK\Include\ServProv.h(48) : System::IServiceProvider IServiceProvider'
or 'Stdafx.cpp(0) : System::IServiceProvider'
How can I use wtypes avoiding this error C2872?
Last edited by Eliseu_CEL; February 1st, 2006 at 03:20 PM.
Reason: better format
-
February 2nd, 2006, 02:16 AM
#2
Re: What can I do to use wtypes without internal errors?
This problem occures because the unmanaged IServiceProvider conflicts with the System::IServiceProvider. You either don't use namespace System or pack the unmanaged included into a namespace.
For example:
Code:
// header
namespace unmanaged
{
# include <windows.h>
}
Code:
// source
#include "myheader.h"
unmanaged::GetDlgItem(/*blabla*/);
-
February 3rd, 2006, 08:02 AM
#3
Re: What can I do to use wtypes without internal errors?
Thank you NoHere.
Actually what I changed, and now everything is working ok, is that.
Old code:
Code:
#pragma once
using namespace System;
using namespace System::Collections;
#pragma unmanaged
#include ".\PDAIncludes\conjpto.h"
#include ".\PDAIncludes\objeto.h"
#include ".\PDAIncludes\lista.h"
#include ".\PDAIncludes\radar.h"
#include ".\PDAIncludes\cvang.h"
#include ".\PDAIncludes\incursor.h"
#pragma managed
namespace IEAv_PDACPP
{
With this I got the Error C2872
New code now:
Code:
#pragma once
#pragma unmanaged
#include ".\PDAIncludes\conjpto.h"
#include ".\PDAIncludes\objeto.h"
#include ".\PDAIncludes\lista.h"
#include ".\PDAIncludes\radar.h"
#include ".\PDAIncludes\cvang.h"
#include ".\PDAIncludes\incursor.h"
#pragma managed
using namespace System;
using namespace System::Collections;
and then, I don't get the error anymore.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|