When I try to compile my code in Visual Studio, I get these errors:
unresolved external symbol s_signal
unresolved external symbol s_list
I believe I have included the relevant m_pd.h header file, and have linked to pd.lib correctly.
This code should reproduce the same issue:
#include "m_pd.h"
#define _USE_MATH_DEFINES // defines maths constants (such as M_PI)
#define MAX_BLOCK_SIZE 4096
#define MAX_ORDER 100
static t_class *example_class;
typedef struct _example {
t_object x_obj;
t_sample f_order;
t_sample f;
t_float prev[MAX_BLOCK_SIZE];
t_float as[MAX_ORDER];
} t_example;
void *example_new(void)
{
// constructor
t_example *x = (t_example *)pd_new(example_class);
// create inlets
inlet_new(&x->x_obj,&x->x_obj.ob_pd,&s_list,gensym("setas"));
// create outlets
outlet_new(&x->x_obj, &s_signal);
return (void *)x;
}
With https://github.com/pure-data/pure-data/blob/master/src/m_pd.h as my m_pd.h file.
I’m a total beginner to C, Visual Studio, and Pure Data, fyi, and the code is over 10 years old, given to me by someone else. I tried compiling it, and initially there were 20-something unresolved externals which I fixed by adding a linker to pd.lib. After that, it was just the two errors mentioned prior. I have looked for definitions of s_list and s_signal online with no luck.
barnet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Add #define PDINSTANCE
above #include "m_pd.h"