By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,111 Members | 1,640 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,111 IT Pros & Developers. It's quick & easy.

error C2197 error

P: n/a
Hello

I am getting this error:

error C2197: 'long (__stdcall *)(void)' : too many actual parameters
Error executing cl.exe.

The offending line is:

if ((lResult = (*pfnGetProviderList)(0x00020000,
pProviderList)) != 0) // this one
{
goto ProviderInstall_freeProviderList;
}

I am converting this C code into C++. Is the problem that compiler
does not understand the parameters required for pfnGetProviderList?
How can I fix?

Feb 14 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Angus wrote:
Hello

I am getting this error:

error C2197: 'long (__stdcall *)(void)' : too many actual parameters
Error executing cl.exe.

The offending line is:

if ((lResult = (*pfnGetProviderList)(0x00020000,
pProviderList)) != 0) // this one
{
goto ProviderInstall_freeProviderList;
}

I am converting this C code into C++. Is the problem that compiler
does not understand the parameters required for pfnGetProviderList?
How can I fix?
Specific implementations and their diagnostics are off-topic for this
group, but see the following link:

<http://support.microsoft.com/kb/117428>

Feb 14 '07 #2

P: n/a
Angus wrote On 02/14/07 12:41,:
Hello

I am getting this error:

error C2197: 'long (__stdcall *)(void)' : too many actual parameters
Error executing cl.exe.

The offending line is:

if ((lResult = (*pfnGetProviderList)(0x00020000,
pProviderList)) != 0) // this one
{
goto ProviderInstall_freeProviderList;
}
The error seems to be saying that you've provided more
arguments than the function expects. Specifically, you've
provided two arguments and the function appears to expect
no arguments.
I am converting this C code into C++. Is the problem that compiler
does not understand the parameters required for pfnGetProviderList?
How can I fix?
It looks like pfnGetProviderList is probably a pointer
to a function. Since you seem convinced that the function
takes two arguments, my guess is that the type of the pointer
is wrong: You've declared it as

long (*pfnGetProviderList)(void);

and initialized it with something like

pfnGetProviderList = (long(*)(void))funcOfTwoArguments;

If this is the situation, then the fix is to convert the
pointer back to the actual type of the called function, with
something like

long (*pf)(T1,T2) = (long(*)(T1,T2))pfnGetProviderList;
if ((lResult = pf(...) ...

where T1 and T2 are the types expected by funcOfTwoArguments.

If that's not the problem, you'll need to show us more code.

--
Er*********@sun.com
Feb 14 '07 #3

P: n/a
Angus wrote, On 14/02/07 17:41:
Hello

I am getting this error:

error C2197: 'long (__stdcall *)(void)' : too many actual parameters
Error executing cl.exe.
This error message says the function does not take any parameters.
The offending line is:

if ((lResult = (*pfnGetProviderList)(0x00020000,
pProviderList)) != 0) // this one
Here you pass a parameter.
{
goto ProviderInstall_freeProviderList;
}

I am converting this C code into C++. Is the problem that compiler
does not understand the parameters required for pfnGetProviderList?
How can I fix?
Either don't pass the function any parameters as it does not expect any
or define/declare that it takes a parameter.

Of course, if you want to know about how to do thing in C++ you should
go down the hall past the water cooler to the third door on the right
where you will find comp.lang.c++ where the C++ gurus hang out.
--
Flash Gordon
Feb 14 '07 #4

P: n/a
On Wed, 14 Feb 2007 13:41:18 -0500, Eric Sosman <Er*********@sun.com>
wrote:
Angus wrote On 02/14/07 12:41,:
error C2197: 'long (__stdcall *)(void)' : too many actual parameters
if ((lResult = (*pfnGetProviderList)(0x00020000,
pProviderList)) != 0) // this one
I am converting this C code into C++. <snip>

It looks like pfnGetProviderList is probably a pointer
to a function. Since you seem convinced that the function
takes two arguments, my guess is that the type of the pointer
is wrong: You've declared it as

long (*pfnGetProviderList)(void);

and initialized it with something like

pfnGetProviderList = (long(*)(void))funcOfTwoArguments;
More likely he declared it like
long (*pfnGetProviderList) () ;
which in C means 'any fixed number of types not altered by the default
promotions', and is compatible with the use -- if and only if the
actual definition (body) of the function does take those two
parameters; but in C++ means the same as (void) and does not match.
If this is the situation, then the fix is to convert the
pointer back to the actual type of the called function, with
something like

long (*pf)(T1,T2) = (long(*)(T1,T2))pfnGetProviderList;
if ((lResult = pf(...) ...

where T1 and T2 are the types expected by funcOfTwoArguments.
or just declare pfnGetProviderList like that in the first place.

- formerly david.thompson1 || achar(64) || worldnet.att.net
Feb 26 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.