You are compiling C code with a now fully compliant C++ compiler so there are some things you need to fix.
I recognize one which is your code has inline stuff which now needs to be __inline
So something like
inline void exchange(int *p1, int *p2)
{
int tmp;
tmp = *p2;
*p2 = *p1;
*p1 = tmp;
}
needs to become
__inline void exchange(int *p1, int *p2)
{
int tmp;
tmp = *p2;
*p2 = *p1;
*p1 = tmp;
}