V
Victor Bazarov
Ekim said:
hy yourself.
I've got a question according default parameters of functions that are
accessed from different files:
---- logging.h ----
void LogTrace(const char* errorLocation, const char* errorInfo = "-");
// define default-param
---- end of logging.h ---
---- logging.cpp ----
#include "Logging.h"
void LogTrace(const char* errorLocation, const char* errorInfo)
{ // define function-body
// do something
}
---- end of logging.cpp ---
and using that function from let's say 2 files in the same project like this
:
--- file1.cpp ---
#include "Logging.h"
and within any function call:
LogTrace("don't use default param", "test"); // call
function without default parameter
LogTrace("use default param"); //
call function with default parameter
--- end of file1.cpp ---
If I call this function as described above in just one .cpp-file, everything
works fine. But as soon as I want to call this function from a second file
within the same project, I get the following error-message:
"LogTrace": redefinition of default parameter: parameter 2
Can someone please tell me what I did wrong?
Could it be you somehow include the "Logging.h" file twice? Put some
double include guards in that file.
Victor