From: William S F. <ws...@fu...> - 2008-06-12 20:24:43
|
Dwarkanath Radhakrishnan wrote: > Hi, > > I'm new to SWIG and I've been trying to create Java wrappers for some > existing C++ code which I have. > While doing so I ran into this problem of using Enums. for example .say > we have the following classes: > > > /* FIlename example.h */ > enum color { RED, BLUE, GREEN }; > > class Foo { > public: > Foo() { } > static const int testenum = GREEN; > enum speed { IMPULSE=10, WARP=20, LUDICROUS=30 }; > void enum_test(speed s); > }; > > void enum_test(color c, Foo::speed s); > > > If I create a java wrappers for this file, then I get this error in > Foo.java after SWIG has created the JAVA wrappers: > > Foo.java:43: ';' expected > public final static int testenum = Foo::testenum; > ^ > Foo.java:43: <identifier> expected > public final static int testenum = Foo::testenum; > ^ > > This is actually from the java enum example that come with the SWIG > package. The only line I added was "static const int testenum = GREEN" > in example.h. > > Can anyone please help me with this problem. If you'd put your code into a standalone interface file you'd see that it compiles fine. I suggest you read http://www.swig.org/Doc1.3/Java.html#constants. You probably have a javaconst(1) in your code somewhere. William |