t_atom error

Jan 30, 2009 at 8:16am

t_atom error

I am doing some examples in “Atoms and Messages” section in max map external tutorial
When I add this line, which is in the tutorial
t_atom argv[3];

it gives error; error C2275: ‘t_atom’ : illegal use of this type as an expression
any idea how to fix this. Do I have to include any header files to get this working

#42004
Jan 30, 2009 at 6:20pm

Quote: wijesena@gmail.com wrote on Fri, 30 January 2009 08:16
—————————————————-
> t_atom argv[3];
—————————————————-

There’s nothing wrong with that, but I suppose it depends on context. What is just preceding this line? And have you included the Max headers? (i.e., #include “ext.h”)

#150024
Jan 30, 2009 at 6:40pm

On Jan 30, 2009, at 12:16 AM, janaka wrote:

> it gives error; error C2275: ‘t_atom’ : illegal use of this type as
> an expression

It sounds like you’re new to C programming, but don’t forget to do a
minimal amount of research before posting questions to the list, and
provide much greater context of your problem so that people can better
assist you. If you googled this error, you would see that this
typically occurs if you define a variable definition somewhere in the
middle of a block rather than at the top of the block before standard
expression statements (which is required by C but not C++ compilers).
Blocks begin and end with curly braces.

http://www.google.com/search?q=%22illegal+use+of+this+type+as+an+expression%22

For example:

void foo(long a, long b)
{
long c;

c = a+b;

long d; // THIS LINE WILL GENERATE THAT ERROR WITH C COMPILER, BUT
NOT C++ COMPILER

d = a-b;
}

as opposed to

void foo(long a, long b)
{
long c;
long d; // THIS LINE WORKS WITH C OR C++ COMPILER

c = a+b;
d = a-b;
}

Good luck!

-Joshua

#150025

You must be logged in to reply to this topic.