here's the full code by the way https://github.com/porres/pd-else/blob/master/Code_source/Compiled/control/var.c

And here's an older version that was compiling and running https://github.com/porres/pd-else/blob/cd1406cff28baf1eb056d1500fb0d62694171306/Code_source/Compiled/control/var.c

cheers

Em seg., 9 de out. de 2023 às 13:22, Alexandre Torres Porres <porres@gmail.com> escreveu:
Hi, I'm working on a new object that is kinda like [value], but much simplified and you can set multiple variable names and output them all as a list (only floats now). It's been fun and it was working, compiling with some weird bugs. I then started revising it and when I thought I could be fixing the last bug, code does not compile now.

What I'm doing is storing multiple variable values and variable names, just like I'm doing with some float values for my new multichannel aware audio objects (one value per channel).

So I have.

typedef struct _var{

    t_object    x_obj;

    t_int       x_n;    // number of given vars as arguments

    t_symbol  **x_sym;  // variable name

    float      *x_fval; // var value

}t_var;


Now, when initializing the variable, in "new", I am trying to get the value of an existing variable name (which is created if it doesn't exist yet). This is done in the same as in [value] by the way

In [value] you have     x->x_floatstar = value_get(s);

I got x->x_fval[i] = var_get(x->x_sym[i] = atom_getsymbol(av+i));

But this gives me the error

                       *

var.c:80:22: error: assigning to 'float' from incompatible type 't_float *'

      (aka 'float *'); dereference with *

        x->x_fval[i] = var_get(x->x_sym[i] = atom_getsymbol(av+i));

                     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Funny enough, I had an older version that would compile and work very well despite some crashes, that initialized x_fval as 

float      **x_fval; // var value



Instead of just "*x_fval", which doesn't seem right.

Please help, and also, at this time, I could take suggestions of some nice and free online C course that would make me intelligent to the point I would have a minimum idea of what I am doing. 

thanks