Using TF1 in compiled code with my own function -- what am I doing wrong?

Helllo @sfpate !
I guess you should use a different TF1 constructor, for example

double chi2_p2bm(double *x, double *par)
{
    return pow(x[0]);
}
...
TF1 *fp2bm = new TF1("fp2bm", chi2_p2bm, 0.1, 0.3, 0);

Here the last argument 0 to the constructor is number of parameters of function, which is actually zero.

Edit: I just realized that the post above gives a more detailed explanation, so mine is just a duplicate. I apologize for my haste and inattention.

Also, it might be useful to take a look at this post about the use of new statement in modern C++:
https://root-forum.cern.ch/t/how-to-properly-delete-ttree-and-tgraph-and-renew-them/55351/2?u=ako_b