I want to copy and paste a C function I found in another program into my C++ program.
One of the function arguments uses the “this” pointer.
void cfunction( FILE *outfilefd, const VARTYPEDEFINED this);
The C++ compiler errors here on the function prototype:
error C2143: syntax error : missing ')' before 'this'
How do I make this C++ usable?
Thanks.
EDIT ( per Betamoo comment )
void cfunction( FILE *outfilefd, const VARTYPEDEFINED this);
{
UINT8 temp = 0;
temp = (UINT8)( this & 0x000000FF );
if ( ( temp > LIMIT ) )
......
else
{
......
}
}
You have two choices. You can leave the code as C, and just create a C++ header to let you call that C code from C++:
Or you can rewrite that function enough to get it to compile as C++ (probably just rename its
thisparameter to something else likethisvar).