I have written mathematica file that does manipulations on a certain set of points. I would like to access code that someone else has written for a least square fit in C++. How do I access this C++ in mathematica?

Some specifics about the code: The least square fit code is a function that accesses a .cpp file and two different .h files. It is a void function that takes in a vector of points, the point itself, and an integer, each called by reference.

I make this specific because I am a novice in coding in c++. I have seen in another post someone say that they have :

I think we have these:

I do not have any of those things, nor do I know what they are. Can someone explain how a novice like myself can handle this situation.

Also, from what I saw from other posts, the function I have to access is much more complicated. It looks something like:

void function1(vectorFoo &thing, Foo &variable1, int64_t &variable2) {

    stuff happens here
}


(the the first argument of the function is a vector that takes in Foo between "<" and ">" but that formatting won't let me show that. that's why I wrote "vectorFoo")

this function accesses other functions,call them "function2", "function3", and other named variables (if that is the right technical term...like I said, I don't know much c++) from three files. so even if I call this file, will I have to worry about calling the other three files from which it draws? Please help!

marked as duplicate by Szabolcs, C. E., MarcoB, Jens, m_goldbergJul 7 '15 at 0:35

• The following one-liner with a list of your coordinate pairs as input in the variable pts finds the circle parameters for you: NMinimize[{((#1 - mx)^2 + (#2 - my)^2 - r^2)^2 & @@@ pts // Total, mx > 0 && my > 0 && r > 0}, {mx, my, r}] – Sjoerd C. de Vries Jul 7 '15 at 14:38