'FILETIME': ambiguous symbol

  • Thread starter Thread starter aunthas
  • Start date Start date
A

aunthas

I want to play sound using winapi, so I wrote these lines of code:-

-------------------------------------------------------------------------------------------------------------------
using namespace System;
using namespace System::Runtime::InteropServices;

namespace WavAPI
{
[DllImport("winmm.dll")]
extern "C" bool sndPlaySound(String* lpszSound, unsigned int fuSound);
}
-------------------------------------------------------------------------------------------------------------------

But I got "FILETIME: ambiguous symbol" when I compiled, because FILETIME
is both the member of InteropService

namespace and defined in WinDef.h.

I tried to use #undef FILETIME, but it didn't work. How can I solve this
problem? Or is there another way to play

sound from API?
 
aunthas said:
I want to play sound using winapi, so I wrote these lines of code:-

-------------------------------------------------------------------------------------------------------------------
using namespace System;
using namespace System::Runtime::InteropServices;

namespace WavAPI
{
[DllImport("winmm.dll")]
extern "C" bool sndPlaySound(String* lpszSound, unsigned int fuSound);
}
-------------------------------------------------------------------------------------------------------------------

But I got "FILETIME: ambiguous symbol" when I compiled, because FILETIME
is both the member of InteropService

namespace and defined in WinDef.h.

I tried to use #undef FILETIME, but it didn't work. How can I solve this
problem? Or is there another way to play

sound from API?


Those lines of code cannot be compiled as shown.
Please provide a minimal code fragment which does
compile and demonstrates your problem.

A fine solution is to not dump the contents of namespace
System::Runtime::InteropServices into the same namespace
in which ::FILETIME is defined. It is your misuse of the
'using' directive which leads to your problem(s).

Another solution is to qualify your use of FILETIME with
the scope you intend to use it from, writing either
::FILETIME
or
System::Runtime::InteropServices::FILETIME

There was a recent thread here on the very same issue.
If you were the originator of that thread, please do not
come back until you understand the namespace issue,
or become willing to address it in some fashion.
 
Back
Top