problem with VC++ and t_atom

Sep 3, 2006 at 10:10pm

problem with VC++ and t_atom

A few externals that are compiling perfectly on my Eclipse Platform,
don’t on my friend’s MS VC++. The maxmspsdk examples are ok, and using
them as a template doesn’t cure. The problem seems to be MS VC++ doesn’t
want to understand t_atom type (errors are in french, but it sounds like
t_atom cannot be a pointer !).
The problematic lines are :

t_atom * templist; // here is the first error
templist->l_templist;

And l_templist was declared in my struct object as t_atom templist[256].

I say again, it’s working perfectly on my Eclipse, but not on VC++ with
maxmspsdk project settings… How could this be ?

f.e


f.e chanfrault | aka | personal computer music
> >>>>>> http://www.personal-computer-music.com
> >>>>>> |sublime music for a desperate people|

#27459
Sep 3, 2006 at 10:28pm

This seems like it might be the proper response from your VC++
compiler. A t_atom is type already defined by Max (defined in
ext_mess.h):

typedef struct atom /* and an atom which is a typed datum */
{
short a_type; /* from the above defs */
union word a_w;
} t_atom, Atom;

It has no l_templist member. It sounds like your object is maybe also
called t_atom, or that you’re thinking that you can add arbitrary
members to an already defined type or something? But sorry, you need
to send more code if you want real help here – what you’ve sent is,
without any context, next to useless.

I would stress that, not just for you, but for all developers on this
list, you need to meet a high standard of question-asking in order to
get us to spend time on issues which are, in the best of times, often
tricky. I might refer you to the document “How To Ask Questions The
Smart Way” (http://www.catb.org/~esr/faqs/smart-questions.html) —
there’s a french translation, too, by the way.

We are overjoyed that people are developing 3rd party objects for
MaxMSP, but please understand, without clear and concise (and
complete) code examples, we can only speculate on the problem you are
having. 2 lines of code is insufficient.

jb

Am 04.09.2006 um 00:10 schrieb f.e:

> A few externals that are compiling perfectly on my Eclipse
> Platform, don’t on my friend’s MS VC++. The maxmspsdk examples are
> ok, and using them as a template doesn’t cure. The problem seems to
> be MS VC++ doesn’t want to understand t_atom type (errors are in
> french, but it sounds like t_atom cannot be a pointer !).
> The problematic lines are :
>
> t_atom * templist; // here is the first error
> templist->l_templist;
>
> And l_templist was declared in my struct object as t_atom templist
> [256].
>
> I say again, it’s working perfectly on my Eclipse, but not on VC++
> with maxmspsdk project settings… How could this be ?
>
> f.e
>
> —
> f.e chanfrault | aka | personal computer music
>> >>>>>> http://www.personal-computer-music.com
>> >>>>>> |sublime music for a desperate people|

#83089
Sep 4, 2006 at 7:38am

> It has no l_templist member. It sounds like your object is maybe also
> called t_atom,
Of course not :

typedef struct _sdmain
{
t_object m_ob;
void *t_bangout;
void *t_anyout;
void *t_listout;
t_object *l_lcdobj;
t_atom l_templist[256];
t_atom l_data[4];
} t_sdmain;

Typicall use of l_templist :

void initlcd(t_sdmain *x)
{
getlcdobj(x); // get the lcd object

t_atom *templist; // pointer of atom type
templist = x->l_templist; // assign first atom of templist
from struct to new pointer

typedmess(x->l_lcdobj, gensym(“clear”), 0L, 0);
typedmess(x->l_lcdobj, gensym(“clearsprites”), 0L, 0);

SETLONG(templist+0, 0); // i guess this is stupid : using a list
for one int !!

typedmess(x->l_lcdobj, gensym(“local”), 1, templist);
typedmess(x->l_lcdobj, gensym(“onscreen”), 1, templist);

SETLONG(templist+0, 1);

typedmess(x->l_lcdobj, gensym(“enablesprites”), 1, templist);

(…)

> or that you’re thinking that you can add arbitrary members to an
> already defined type or something? But sorry, you need to send more
> code if you want real help here – what you’ve sent is, without any
> context, next to useless.
>
> I would stress that, not just for you, but for all developers on this
> list, you need to meet a high standard of question-asking in order to
> get us to spend time on issues which are, in the best of times, often
> tricky. I might refer you to the document “How To Ask Questions The
> Smart Way” (http://www.catb.org/~esr/faqs/smart-questions.html) —
> there’s a french translation, too, by the way.
>
> We are overjoyed that people are developing 3rd party objects for
> MaxMSP, but please understand, without clear and concise (and
> complete) code examples, we can only speculate on the problem you are
> having. 2 lines of code is insufficient.
>
> jb
>
> Am 04.09.2006 um 00:10 schrieb f.e:
>
>> A few externals that are compiling perfectly on my Eclipse Platform,
>> don’t on my friend’s MS VC++. The maxmspsdk examples are ok, and
>> using them as a template doesn’t cure. The problem seems to be MS
>> VC++ doesn’t want to understand t_atom type (errors are in french,
>> but it sounds like t_atom cannot be a pointer !).
>> The problematic lines are :
>>
>> t_atom * templist; // here is the first error
>> templist->l_templist;
>>
>> And l_templist was declared in my struct object as t_atom templist[256].
>>
>> I say again, it’s working perfectly on my Eclipse, but not on VC++
>> with maxmspsdk project settings… How could this be ?
>>
>> f.e
>>
>> –f.e chanfrault | aka | personal computer music
>>> >>>>>> http://www.personal-computer-music.com
>>> >>>>>> |sublime music for a desperate people|
>
>

#83090
Sep 4, 2006 at 8:39am

Thanks for the more explicit code example.

The problem that you are having is that you are defining a variable
after the start of the code block. This is OK in C++, but not in C.

void initlcd(t_sdmain *x)
{
t_atom *templist; // in C, all variable declarations need to be made
at the top of the code block

getlcdobj(x); // get the lcd object
templist = x->l_templist; // assign first atom of templist from
struct to new pointer}

}

jb

Am 04.09.2006 um 09:38 schrieb f.e:

>
>> It has no l_templist member. It sounds like your object is maybe
>> also called t_atom,
> Of course not :
>
> typedef struct _sdmain
> {
> t_object m_ob; void
> *t_bangout; void *t_anyout;
> void *t_listout;
> t_object *l_lcdobj;
> t_atom l_templist[256]; t_atom l_data
> [4];
> } t_sdmain;
>
> Typicall use of l_templist :
>
> void initlcd(t_sdmain *x)
> {
> getlcdobj(x); // get the lcd object
> t_atom *templist; // pointer of atom type
> templist = x->l_templist; // assign first atom of
> templist from struct to new pointer
> typedmess(x->l_lcdobj, gensym(“clear”), 0L, 0);
> typedmess(x->l_lcdobj, gensym(“clearsprites”), 0L, 0);
> SETLONG(templist+0, 0); // i guess this is stupid :
> using a list for one int !!
> typedmess(x->l_lcdobj, gensym(“local”), 1, templist);
> typedmess(x->l_lcdobj, gensym(“onscreen”), 1, templist);
> SETLONG(templist+0, 1);
> typedmess(x->l_lcdobj, gensym(“enablesprites”), 1,
> templist);
>
> (…)
>
>> or that you’re thinking that you can add arbitrary members to an
>> already defined type or something? But sorry, you need to send
>> more code if you want real help here – what you’ve sent is,
>> without any context, next to useless.
>>
>> I would stress that, not just for you, but for all developers on
>> this list, you need to meet a high standard of question-asking in
>> order to get us to spend time on issues which are, in the best of
>> times, often tricky. I might refer you to the document “How To Ask
>> Questions The Smart Way” (http://www.catb.org/~esr/faqs/smart-
>> questions.html) — there’s a french translation, too, by the way.
>>
>> We are overjoyed that people are developing 3rd party objects for
>> MaxMSP, but please understand, without clear and concise (and
>> complete) code examples, we can only speculate on the problem you
>> are having. 2 lines of code is insufficient.
>>
>> jb
>>
>> Am 04.09.2006 um 00:10 schrieb f.e:
>>
>>> A few externals that are compiling perfectly on my Eclipse
>>> Platform, don’t on my friend’s MS VC++. The maxmspsdk examples
>>> are ok, and using them as a template doesn’t cure. The problem
>>> seems to be MS VC++ doesn’t want to understand t_atom type
>>> (errors are in french, but it sounds like t_atom cannot be a
>>> pointer !).
>>> The problematic lines are :
>>>
>>> t_atom * templist; // here is the first error
>>> templist->l_templist;
>>>
>>> And l_templist was declared in my struct object as t_atom templist
>>> [256].
>>>
>>> I say again, it’s working perfectly on my Eclipse, but not on VC+
>>> + with maxmspsdk project settings… How could this be ?
>>>
>>> f.e
>>>
>>> –f.e chanfrault | aka | personal computer music
>>>> >>>>>> http://www.personal-computer-music.com
>>>> >>>>>> |sublime music for a desperate people|
>>
>>

#83091

You must be logged in to reply to this topic.