Usage of nloptLBFGS - interpret error

Hello, I want to use nloptLBFGS for an optimization problem. I managed to get a minimal test running, but when I try to apply the same syntax to the problem of interest I get the error below. It talks about a macro error, but I used “func” to define the gradient.

the line where the optimizer is called looks like:
nloptLBFGS(J,u[],grad=GradJ);

The error report is given below:

nloptLBFGS(J,u[],grad= we waiting for a '('
  current line = 109
Compile error :  err macro 
	line number :109, =
error Compile error :  err macro 
	line number :109, =
 code = 1 mpirank: 0

On the other hand, the following example seems to work:

load "ff-NLopt"

func real J(real[int] &v){
   real[int] ve = v.*v;
   return ve.sum;
}

func real[int] GradJ(real[int] &v){
   real[int] res = 2*v;
   return v;
}

real[int] x0 = [1.1,2,-1];
real mm = nloptLBFGS(J,x0,grad=GradJ);

cout << "Minimum: " << mm ;
cout << x0 <<endl;

Sorry for bothering you… I found the solution. It turns out I defined a macro named grad before, so when calling the option grad=GradJ FreeFem tried to replace the macro.
Best regards,
Beniamin