1

I am not very familiar with C++ and here I am confronted with an error which I couldn't find answer from web.

I am trying to compile an example code which imports functions from a dll.

I am using VS 2010 Professional.

The problem is I get an error message saying:

error C2660: 'CDialog::Initialize': function does not take 4 arguments.

When I look at the 'Initilize()' function, I see that actually it is not a CDialog:: function but something completely different function from the dll, where the header file is include in the .cpp. It's the compiler misunderstanding it to CDialog:: and I see that since the class of the function in which the Initialize() is being called is actually inherited from CDialog.

What would be the simplest fix for this problem ?

Thanks in advance

swcraft
  • 2,014
  • 3
  • 22
  • 43

1 Answers1

3

Specify the correct function to be called with Namespace::Initialize() or Class::Initialize(), or just ::Initialize() if the function is not a member of any namespace or class.

aschepler
  • 70,891
  • 9
  • 107
  • 161
  • thanks, however all I see is the header file for that function. What can I do then ? – swcraft Oct 20 '11 at 00:39
  • I don't understand the question. You probably just need to change the line where the compiler is complaining. – aschepler Oct 20 '11 at 00:46
  • There is no namespace or Class for that function. All I see for the function declaration is in a header file and probably the function is in directly called from dll. – swcraft Oct 20 '11 at 00:48
  • So on the line with compile error, try just changing `Initialize` to `::Initialize`. – aschepler Oct 20 '11 at 00:52
  • thank!I thought that ::Initialize would really tell compiler that this function belongs to CDialog.. how did adding :: make compiler understand it belongs to the dll ??? – swcraft Oct 20 '11 at 00:56
  • for other novices like me, here I link the answer. http://stackoverflow.com/questions/4269034/what-is-the-meaning-of-prepended-double-colon-to-class-name – swcraft Oct 20 '11 at 01:04