B
Bill Davidson
All:
I recently had to include a common header file into a straight C (.c file).
This header file contains a function prototype that has a default argument.
For example
int MyFunc(int MyArg = 10);
The compiler has no problems when I include this header file into a C++
(.cpp) source file, but croaks when I include it in a C (.c) source file.
The error(s) are as follows.
error C2143: syntax error : missing ')' before '='
error C2072: 'MyFunc' : initialization of a function
This isn't surprising since default arguments are a part of C++, not C.
My question: How can I compile this C module under C++ such that the header
file can successfully be compiled into this project?
Thanks,
Bill
I recently had to include a common header file into a straight C (.c file).
This header file contains a function prototype that has a default argument.
For example
int MyFunc(int MyArg = 10);
The compiler has no problems when I include this header file into a C++
(.cpp) source file, but croaks when I include it in a C (.c) source file.
The error(s) are as follows.
error C2143: syntax error : missing ')' before '='
error C2072: 'MyFunc' : initialization of a function
This isn't surprising since default arguments are a part of C++, not C.
My question: How can I compile this C module under C++ such that the header
file can successfully be compiled into this project?
Thanks,
Bill