Forums > Dev

t_atom error

January 30, 2009 | 8:16 am

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


January 30, 2009 | 6:20 pm

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")


January 30, 2009 | 6:40 pm

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


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