Forums > Dev

Error in "z_dsp.h" file

July 5, 2010 | 10:25 am

Good morning,
I'm developing a simple Max/MSP external to manage audio signals.
When I build my code, I get an error from the header "z_dsp.h".
The error is (screen snapshot attached):

error: syntax error before 'vector'

Searching in the forum it seems that the problem comes from my setup.
I use MacOS 10.5.8 on Powerbook G4 (PPC), MaxSDK 5.1.1 (tryed also with 5.0.6) and XCode.
Could you help me please?

[attachment=136180,770]

Attachments:
  1. Immagine_1.png

July 5, 2010 | 3:46 pm

Hello maxer,

not easy to help with just a png ;

‘include "ext.h" instead of #include "ext.h" ???
and you don’t have return 0 ; in your main function …

here an example of a "do nothing" external :

/*
	flip~ do nothing.
*/

// --------------------

#include "ext.h"
#include "ext_obex.h"
#include "z_dsp.h"

// --------------------

typedef struct _flip {
	t_pxobject ob ;
	} t_flip ;

// --------------------

void	*flip_new (t_symbol *s, long argc, t_atom *argv) ;
void	flip_free (t_flip *x) ;

void	flip_dsp (t_flip *x, t_signal **sp, short *count) ;
t_int	*dsp_perform (t_int *w) ;

// --------------------

static t_class *flip_class ;

int main (void)
	{
		t_class *c = NULL ;

		c = class_new ("flip~", (method)flip_new, (method)flip_free, (long)sizeof(t_flip), 0L, A_GIMME, 0) ;
		class_dspinit (c) ;
		class_addmethod (c, (method)flip_dsp, "dsp", A_CANT, 0) ;
		class_register (CLASS_BOX, c) ;
		flip_class = c ;

		return 0 ;
	}

void *flip_new (t_symbol *s, long argc, t_atom *argv)
	{
		t_flip *x = NULL ;

		if (x = (t_flip *)object_alloc(flip_class))
			{
				outlet_new ((t_object *)x, "signal") ;
				dsp_setup ((t_pxobject *)x, 1) ;
			}

		return x ;
	}

void flip_free (t_flip *x)
	{
		dsp_free ((t_pxobject *)x) ;
	}

void flip_dsp (t_flip *x, t_signal **sp, short *count)
	{
		dsp_add (dsp_perform, 4, x, sp[0]->s_vec, sp[0]->s_n, sp[1]->s_vec) ;
	}

t_int *dsp_perform (t_int *w)
	{
		t_flip *x = (t_flip *)w[1] ;
		t_float *in = (t_float *)w[2] ;
		long n = (long)w[3] ;
		t_float *out = (t_float *)w[4] ;

		long i ;

		if (x->ob.z_disabled)
			{
				return w + 5 ;
			}

		for (i = 0 ; i < n ; i ++)
			{
				out[i] = in[i] ;
			}	

		return w + 5 ;
	}

// --------------------

July 6, 2010 | 9:26 am

Thanks a lot for your reply pizza!

The ‘include (instead of #include) was a typing error, I fixed it a while after the post…sorry…
I didn’t put "return 0" in main() because is a void function, I don’t need to return any value. I’m not sure but I think that the problem is not there.
I tried your code but unfortunately the error still remains…any other hints?

If you need some more information about the code, or about the environment fell free to ask!
Thanks


July 6, 2010 | 11:42 am

Hi,

It sounds like you have a compiler setting that turns Altivec on. If you switch that off then I think you will be fine.

Cheers,
Tim


July 7, 2010 | 1:00 pm

Hi Timothy, thanks a lot for your reply!

I analyzed your ‘maxmspSDK.xcconfig’ file from ‘MaxSDK/example’ and the my problem seems to be the ‘MAXOS Deployment target’.
Changing this parameter to 10.4 instead of 10.5 (like in the .xcconfig file), everything works. With the 10.5 version it returns to me the "syntax error before ‘vector’ ".
I can’t understand why…all I can say is that I’m using use MacOS 10.5.8…


Viewing 5 posts - 1 through 5 (of 5 total)