[Help] const and enum type definition in LCM Type Specification

211 views
Skip to first unread message

StanleyHsu

unread,
Feb 21, 2012, 8:38:05 PM2/21/12
to Lightweight Communications and Marshalling
I am trying lcm-0.7.1 as the message exchange of process in same cpu.
I want to define a const or enum type in lcm file but failed according
to http://lcm.googlecode.com/svn/www/reference/lcm/type_specification.html

Looking forward for your help....Thanks very much....


As the statement in <LCM Type Specification Language>
LCM provides a simple way of declaring constants that can subsequently
be used to populate other data fields.
Constants can be declared by using the const keyword.
const int32_t YELLOW=1, GOLDENROD=2, CANARY=3;

my whole test.lcm file content as follows:
package test;
const int32_t YELLOW=1, GOLDENROD=2, CANARY=3;

$lcm-gen -c test.lcm
then I got
Missing struct/enum/union token.
test.lcm : 3
const int32_t YELLOW=1, GOLDENROD=2, CANARY=3;
^

Thanks
Brs, StanleyHsu

Albert Huang

unread,
Feb 21, 2012, 9:06:18 PM2/21/12
to lcm-...@googlegroups.com
Everything needs to be inside a struct declaration. Example:

http://code.google.com/p/lcm/source/browse/trunk/examples/types/exampleconst_t.lcm

Regards,
Albert

> --
> You received this message because you are subscribed to the Google Groups "Lightweight Communications and Marshalling" group.
> To post to this group, send email to lcm-...@googlegroups.com.
> To unsubscribe from this group, send email to lcm-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/lcm-users?hl=en.
>

Reply all
Reply to author
Forward
0 new messages