I know the immediate cause of your problem. But to recommend the best solution requires expertise with mathlib that I do not have.
The prototype for the function divdp (which probably appears in a header file from mathlib) needs to look something like ...
extern "C" { // ... double divdp(double, double); // ... }
Adding the extern "C" defeats the name mangling of the function name.
You could wrap extern "C" around the lines that #include the mathlib header files in your C++ files. I don't know if that is the recommended solution for C++ and mathlib. I'm not sure if mathlib supports C++.
Thanks and regards,
-George