I have done a program with windows forms in "Visual C++". I have implemented a function that returns two values. For example:
double functionExample (int parameter, [Out] double __gc* result2);
And in a header file, I have written this line:
using namespace System::Runtime ::InteropServic es;
This line is necessary for [Out] key word. But when compiling the project, I get this error:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Platfo rmSDK\Include\W inBase.h(3140): error C2872: 'FILETIME' : ambiguous symbol could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Platfo rmSDK\Include\W inDef.h(354) : _FILETIME FILETIME' or 'stdafx.cpp(0) : System::Runtime ::InteropServic es::FILETIME'
How can I solve it? Thanks.
--
Message posted via http://www.dotnetmonster.com 5 2552
You could try using:
#undef FILETIME
using namespace System::Runtime ::InteropServic es;
You're unlikely to need the version in WinDef.h in this compilation unit.
This sort of thing's quite common (MessageBox is one) and occurs because the
standard Windows headers (usually included from <windows.h>) have a load of
#defines that clash with .NET-defined stuff.
Steve
"rodri rodri via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in
message news:d9******** *************** *******@DotNetM onster.com... I have done a program with windows forms in "Visual C++". I have implemented a function that returns two values. For example:
double functionExample (int parameter, [Out] double __gc* result2);
And in a header file, I have written this line:
using namespace System::Runtime ::InteropServic es;
This line is necessary for [Out] key word. But when compiling the project, I get this error:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Platfo rmSDK\Include\W inBase.h(3140): error C2872: 'FILETIME' : ambiguous symbol could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Platfo rmSDK\Include\W inDef.h(354) : _FILETIME FILETIME' or 'stdafx.cpp(0) : System::Runtime ::InteropServic es::FILETIME'
How can I solve it? Thanks.
-- Message posted via http://www.dotnetmonster.com
Thank you for answering me. I have tried to solve it writing:
#undef FILETIME
But the problem does not get solved and keeps on giving the same error.
"File1.h" has this line: "using namespace System::Runtime ::InteropServic es;"
And "Form1.cpp" has this line: "#include <windows.h>
/*File1.h*/
#pragma once
using namespace System::Runtime ::InteropServic es;
public __gc __interface interface1
{
public:
double function1(int parameter, [Out] double __gc& result2);
};
/*Form1.h*/
#include "stdafx.h"
#include "Form1.h"
#include <windows.h>
using namespace namespace1;
int APIENTRY _tWinMain(HINST ANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
System::Threadi ng::Thread::Cur rentThread->ApartmentSta te =
System::Threadi ng::ApartmentSt ate::STA;
Application::Ru n(new Form1());
return 0;
}
/*stdafx.h*/
#pragma once
#define WIN32_LEAN_AND_ MEAN
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include "File1.h"
----------------------------------------------------------
"Steve McLellan" wrote: You could try using: #undef FILETIME using namespace System::Runtime ::InteropServic es;
You're unlikely to need the version in WinDef.h in this compilation unit. This sort of thing's quite common (MessageBox is one) and occurs because the standard Windows headers (usually included from <windows.h>) have a load of #defines that clash with .NET-defined stuff.
Steve
"rodri rodri via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in message news:d9******** *************** *******@DotNetM onster.com...I have done a program with windows forms in "Visual C++". I have implemented a function that returns two values. For example:
double functionExample (int parameter, [Out] double __gc* result2);
And in a header file, I have written this line:
using namespace System::Runtime ::InteropServic es;
This line is necessary for [Out] key word. But when compiling the project, I get this error:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Platfo rmSDK\Include\W inBase.h(3140): error C2872: 'FILETIME' : ambiguous symbol could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\Platfo rmSDK\Include\W inDef.h(354) : _FILETIME FILETIME' or 'stdafx.cpp(0) : System::Runtime ::InteropServic es::FILETIME'
How can I solve it? Thanks.
-- Message posted via http://www.dotnetmonster.com
Hi,
This example code doesn't make sense; the code labelled as Form1.h is (I
presume) meant to be Form1.cpp but Form1.h doesn't appear to be present.
Where did you put the #undef FILETIME? It needs to come after #include
<windows.h> but before using namespace System::Runtime ::InteropServic es
If this still doesn't work, then it may be something else, but I've seen
this problem before (though not specifically with FILETIME) and it's been
due to this kind of name clash every time.
Steve
"rahoo" <ra***@discussi ons.microsoft.c om> wrote in message
news:81******** *************** ***********@mic rosoft.com... Thank you for answering me. I have tried to solve it writing: #undef FILETIME
But the problem does not get solved and keeps on giving the same error.
"File1.h" has this line: "using namespace System::Runtime ::InteropServic es;" And "Form1.cpp" has this line: "#include <windows.h>
/*File1.h*/
#pragma once
using namespace System::Runtime ::InteropServic es;
public __gc __interface interface1 { public: double function1(int parameter, [Out] double __gc& result2); };
/*Form1.h*/
#include "stdafx.h" #include "Form1.h" #include <windows.h>
using namespace namespace1;
int APIENTRY _tWinMain(HINST ANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { System::Threadi ng::Thread::Cur rentThread->ApartmentSta te = System::Threadi ng::ApartmentSt ate::STA; Application::Ru n(new Form1()); return 0; }
/*stdafx.h*/
#pragma once
#define WIN32_LEAN_AND_ MEAN
#include <stdlib.h> #include <malloc.h> #include <memory.h> #include <tchar.h>
#include "File1.h"
---------------------------------------------------------- "Steve McLellan" wrote:
You could try using: #undef FILETIME using namespace System::Runtime ::InteropServic es;
You're unlikely to need the version in WinDef.h in this compilation unit. This sort of thing's quite common (MessageBox is one) and occurs because the standard Windows headers (usually included from <windows.h>) have a load of #defines that clash with .NET-defined stuff.
Steve
"rodri rodri via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in message news:d9******** *************** *******@DotNetM onster.com... >I have done a program with windows forms in "Visual C++". I have >implemented a function that returns two values. For example: > > double functionExample (int parameter, [Out] double __gc* result2); > > And in a header file, I have written this line: > > using namespace System::Runtime ::InteropServic es; > > This line is necessary for [Out] key word. But when compiling the > project, > I get this error: > > C:\Program Files\Microsoft Visual Studio .NET > 2003\Vc7\Platfo rmSDK\Include\W inBase.h(3140): error C2872: 'FILETIME' : > ambiguous symbol could be 'C:\Program Files\Microsoft Visual Studio > .NET > 2003\Vc7\Platfo rmSDK\Include\W inDef.h(354) : _FILETIME FILETIME' or > 'stdafx.cpp(0) : System::Runtime ::InteropServic es::FILETIME' > > How can I solve it? Thanks. > > -- > Message posted via http://www.dotnetmonster.com
If you look at the diagnostics that the OP got, you will realize
that the problem cannot be a preprocessor issue. The name
that gives rise to the ambiguity, (as a result of an unfortunate
use of the 'using' directive), is declared in both the global
namespace and the namespace he has dumped via 'using'.
He can #undef that name until Hell freezes over, but since
it was never #define'd in the first place, it will do no good.
When the OP finally fixes this, it will be by some variation
on the advice I gave days ago. Until then, all I can say is:
Have fun fiddling with the irrelevant preprocessor.
--
--Larry Brasfield
email: do************* **********@hotm ail.com
Above views may belong only to me.
"Steve McLellan" <sjm AT fixerlabs DOT com> wrote in message
news:uM******** *****@TK2MSFTNG P11.phx.gbl... Hi,
This example code doesn't make sense; the code labelled as Form1.h is (I presume) meant to be Form1.cpp but Form1.h doesn't appear to be present. Where did you put the #undef FILETIME? It needs to come after #include <windows.h> but before using namespace System::Runtime ::InteropServic es
If this still doesn't work, then it may be something else, but I've seen this problem before (though not specifically with FILETIME) and it's been due to this kind of name clash every time.
Steve
"rahoo" <ra***@discussi ons.microsoft.c om> wrote in message news:81******** *************** ***********@mic rosoft.com... Thank you for answering me. I have tried to solve it writing: #undef FILETIME
But the problem does not get solved and keeps on giving the same error.
"File1.h" has this line: "using namespace System::Runtime ::InteropServic es;" And "Form1.cpp" has this line: "#include <windows.h>
/*File1.h*/
#pragma once
using namespace System::Runtime ::InteropServic es;
public __gc __interface interface1 { public: double function1(int parameter, [Out] double __gc& result2); };
/*Form1.h*/
#include "stdafx.h" #include "Form1.h" #include <windows.h>
using namespace namespace1;
int APIENTRY _tWinMain(HINST ANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { System::Threadi ng::Thread::Cur rentThread->ApartmentSta te = System::Threadi ng::ApartmentSt ate::STA; Application::Ru n(new Form1()); return 0; }
/*stdafx.h*/
#pragma once
#define WIN32_LEAN_AND_ MEAN
#include <stdlib.h> #include <malloc.h> #include <memory.h> #include <tchar.h>
#include "File1.h"
---------------------------------------------------------- "Steve McLellan" wrote:
You could try using: #undef FILETIME using namespace System::Runtime ::InteropServic es;
You're unlikely to need the version in WinDef.h in this compilation unit. This sort of thing's quite common (MessageBox is one) and occurs because the standard Windows headers (usually included from <windows.h>) have a load of #defines that clash with .NET-defined stuff.
Steve
"rodri rodri via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in message news:d9******** *************** *******@DotNetM onster.com... >I have done a program with windows forms in "Visual C++". I have >implemented a function that returns two values. For example: > > double functionExample (int parameter, [Out] double __gc* result2); > > And in a header file, I have written this line: > > using namespace System::Runtime ::InteropServic es; > > This line is necessary for [Out] key word. But when compiling the project, > I get this error: > > C:\Program Files\Microsoft Visual Studio .NET > 2003\Vc7\Platfo rmSDK\Include\W inBase.h(3140): error C2872: 'FILETIME' : > ambiguous symbol could be 'C:\Program Files\Microsoft Visual Studio .NET > 2003\Vc7\Platfo rmSDK\Include\W inDef.h(354) : _FILETIME FILETIME' or > 'stdafx.cpp(0) : System::Runtime ::InteropServic es::FILETIME' > > How can I solve it? Thanks. > > -- > Message posted via http://www.dotnetmonster.com
Hi,
My apologies.
Steve
"Larry Brasfield" <do************ ***********@hot mail.com> wrote in message
news:eK******** ******@TK2MSFTN GP15.phx.gbl... If you look at the diagnostics that the OP got, you will realize that the problem cannot be a preprocessor issue. The name that gives rise to the ambiguity, (as a result of an unfortunate use of the 'using' directive), is declared in both the global namespace and the namespace he has dumped via 'using'. He can #undef that name until Hell freezes over, but since it was never #define'd in the first place, it will do no good.
When the OP finally fixes this, it will be by some variation on the advice I gave days ago. Until then, all I can say is: Have fun fiddling with the irrelevant preprocessor.
-- --Larry Brasfield email: do************* **********@hotm ail.com Above views may belong only to me.
"Steve McLellan" <sjm AT fixerlabs DOT com> wrote in message news:uM******** *****@TK2MSFTNG P11.phx.gbl... Hi,
This example code doesn't make sense; the code labelled as Form1.h is (I presume) meant to be Form1.cpp but Form1.h doesn't appear to be present. Where did you put the #undef FILETIME? It needs to come after #include <windows.h> but before using namespace System::Runtime ::InteropServic es
If this still doesn't work, then it may be something else, but I've seen this problem before (though not specifically with FILETIME) and it's been due to this kind of name clash every time.
Steve
"rahoo" <ra***@discussi ons.microsoft.c om> wrote in message news:81******** *************** ***********@mic rosoft.com... Thank you for answering me. I have tried to solve it writing: #undef FILETIME
But the problem does not get solved and keeps on giving the same error.
"File1.h" has this line: "using namespace System::Runtime ::InteropServic es;" And "Form1.cpp" has this line: "#include <windows.h>
/*File1.h*/
#pragma once
using namespace System::Runtime ::InteropServic es;
public __gc __interface interface1 { public: double function1(int parameter, [Out] double __gc& result2); };
/*Form1.h*/
#include "stdafx.h" #include "Form1.h" #include <windows.h>
using namespace namespace1;
int APIENTRY _tWinMain(HINST ANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { System::Threadi ng::Thread::Cur rentThread->ApartmentSta te = System::Threadi ng::ApartmentSt ate::STA; Application::Ru n(new Form1()); return 0; }
/*stdafx.h*/
#pragma once
#define WIN32_LEAN_AND_ MEAN
#include <stdlib.h> #include <malloc.h> #include <memory.h> #include <tchar.h>
#include "File1.h"
---------------------------------------------------------- "Steve McLellan" wrote:
You could try using: #undef FILETIME using namespace System::Runtime ::InteropServic es;
You're unlikely to need the version in WinDef.h in this compilation unit. This sort of thing's quite common (MessageBox is one) and occurs because the standard Windows headers (usually included from <windows.h>) have a load of #defines that clash with .NET-defined stuff.
Steve
"rodri rodri via DotNetMonster.c om" <fo***@DotNetMo nster.com> wrote in message news:d9******** *************** *******@DotNetM onster.com... >I have done a program with windows forms in "Visual C++". I have >implemented a function that returns two values. For example: > > double functionExample (int parameter, [Out] double __gc* result2); > > And in a header file, I have written this line: > > using namespace System::Runtime ::InteropServic es; > > This line is necessary for [Out] key word. But when compiling the > project, > I get this error: > > C:\Program Files\Microsoft Visual Studio .NET > 2003\Vc7\Platfo rmSDK\Include\W inBase.h(3140): error C2872: 'FILETIME' > : > ambiguous symbol could be 'C:\Program Files\Microsoft Visual Studio > .NET > 2003\Vc7\Platfo rmSDK\Include\W inDef.h(354) : _FILETIME FILETIME' or > 'stdafx.cpp(0) : System::Runtime ::InteropServic es::FILETIME' > > How can I solve it? Thanks. > > -- > Message posted via http://www.dotnetmonster.com
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: EHuq |
last post by:
Hi there
I am facing a problem. When I include my unmanaged header file in my form1.h file, I am facing the compile error with the following messag
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(7408) : error C2872: 'IDataObject' : ambiguous symbo
could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ObjIdl.h(246) : System::Windows::Forms::IDataObject IDataObject
or ...
|
by: Lee Gillie |
last post by:
I have a VS6 project which I brought into VS .NET, and all has been
building fine. Then I upgraded to VS 2003 and I have one source which
will no longer compile. Any clues?
Compiling...
DotNetManagedExport.cpp
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\atlmfc\include\atlcom.h(5529) : error C2872: 'CONNECTDATA' :
ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET
|
by: gerry.brennan |
last post by:
Hi,
I have a project which accesses a database via a database interface
class which uses #include microsoft library.
In the header file for this database class I have a prototype which
passes by reference a CRecordset paramater.
|
by: nicolas.hilaire |
last post by:
Hi group,
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.
|
by: Prasad |
last post by:
HI,
I am a beginner in VC++..
I am trying to write a Win32 console application in visual studio..
I am using following header files..
#include <STRING>
using namespace std;
#include <hash_map>//from Standard template library
//and some other headers
| |
by: davidk13 |
last post by:
My C++/CLI program uses the WinAPI to create a document, and my use of the
Rectangle function--BOOL Rectangle (HDC hDC, int nLeft, int nTOP, int nRight,
int nBottom--results in a compiler error C2872-'Rectangle':ambiguous symbol.
How can I resolve this ambiguity?
Thanks,
David
|
by: phnimx |
last post by:
I'm attempting to migrate a predominately MFC application that I've just
inherited from
Visual Studio.NET 2003 to Visual Studio 2005. I've managed to clean up a
myriad of compile and link errors but I'm stuck on one final problem.
Please note that this application compiled/linked and ran just fine out of
Visual Studio.NET 2003.
Details:
It's originally incarnated as an MFC app, i.e. CWinApp, CMultiDocTemplate,
|
by: kartik369 |
last post by:
hi while compiling my code im getting these errors:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinBase.h(4729): error C2872: 'FILETIME' : ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(354) : _FILETIME FILETIME'
or 'stdafx.cpp(0) : System::Runtime::InteropServices::FILETIME'
can anyone let me know how to resolve this...
|
by: dakshayini |
last post by:
Hi,
I have created one project in Visual studio 2005.
For my application i need to put Sleep() function.n i have added the #include <windows.h>
Now if i run this i am getting error as' IServiceProvider' : ambiguous symbol
Please if any one knows about this let me know..
Actually i have created in one more project with single form n if i include this sleep function it is running properly..if i put the same in my Application i am...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |