What can be the reason for ambiguous call?

Hi,

This is my code :

<Code>
// The BROWSEINFO struct tells the shell
// how it should display the dialog.

BROWSEINFO bi;
memset(&bi, '\0', sizeof(bi));

</Code>

I am getting the following error in my C++ program.

"Error - memset() - Ambiguous call to overloaded function."

What are the possibilities to get the above mentioned error?

Help me!!!
All I can think of is that either you or one of the included headers overloaded memset().
Try rewriting it like this: memset((void *)&bi,(int)'\0',(size_t)sizeof(bi))
Last edited on
Make sure you have included the header file with the prototype for memset(), this will be different depending on the system you are working on so look up the help page for details.
Hmm... Although that should produce an undeclared symbol error, not an ambiguous call error.
Yes I agree, but compiler errors are often nothing to do with the actual problem. Experience has taught me that compilers cannot be relied on to tell you what is wrong, just that something is wrong and that it is vaguely to do with the error it is reporting.
Hi helios,

I checked with type conversion also as you said. Also i included the <cstring> header file.
But still i am getting the same error.

Help me!!!!
Hello!

Is this BROWSEINFO a structure? I found it at http://msdn.microsoft.com/en-us/library/bb773205(VS.85).aspx
Because this memset function is meant to copy the same data to a buffer. I think this function cannot handle the structure as a buffer. So, if you want to initialize the bi variable, I think you should do it by hand or with a function or a constructor(if it has).
Hi Harry,

I have initialized that structure manually and i removed memset().

Now it is working fine.

Thank you guys.

But still i don't know the solution for that ambiguous call..

Thanks.
Topic archived. No new replies allowed.