A problem with header files...

Started by
2 comments, last by X_Breaker 22 years, 2 months ago
Here's the setup (thus far): I have two source files, and one header file. In one source file, I have a function, "DirectX_Init()" and in the other source file, I have a call to the aforementioned function. I also declare it as an extern in the header file. But, I'm getting redefinition errors for the variables in the function. The function itself, as listed in the source file: int DirectX_Init(void* parms = NULL, num_parms = 0) { // code } The call to the function in the other source file: DirectX_Init(); And finally, the function as listed in the header file so that it can be called: extern int DirectX_Init(void* parms = NULL, num_parms = 0); Upon compiling, I get the following two errors: error C2572: 'DirectX_Init' : redefinition of default parameter : parameter 2 error C2572: 'DirectX_Init' : redefinition of default parameter : parameter 1 How do I fix this? Edited by - X_Breaker on February 6, 2002 2:49:12 AM
Advertisement
Try to remove the ... = NULL and ... = 0 from the definition of the function in the cpp file.
That may be the cause of the problem.
baumep
I think you''re right... however, now I''m getting linker errors. I''m pretty sure they''re unrelated, however. Man... trying to get multiple files to work together should NOT be this hard...
I got it now. Duh... I forgot to call INITGUID.

This topic is closed to new replies.

Advertisement