Statechart compile error on OS X

I'm trying to use Boost.Statechart in an iPhone development project. When I build the Hello World example in a .mm file (Objective C++) I get an error "error: no class template named 'rebind' in 'struct Machine'". If, in the same project, I build the statemachine in a .cpp file (C++) and call a C function from a .mm file it works perfectly. Is there a compiler flag or project setting that I need to change to get the state machine to work from a .mm file? I would really like the state machine to be a member of an Objective C class.

Hi Daniel All of what I say in this post is derived from the Wikipedia entry on Objective-C++ http://en.wikipedia.org/wiki/Objective-C#Objective-C.2B.2B
When I build the Hello World example in a .mm file (Objective C++) I get an error "error: no class template named 'rebind' in 'struct Machine'".
Given the huge differences between pure standard C++ and pure Objective-C++, I'm not surprised this doesn't work.
If, in the same project, I build the statemachine in a .cpp file (C++) and call a C function from a .mm file it works perfectly.
That's good to hear, apparently the standard C++ part of Objective-C++ really is quite standard. [snip]
would really like the state machine to be a member of an Objective C class.
This might work if you reference the state machine via pointer data member. HTH, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.

would really like the state
machine to be a member of an Objective C class.
This might work if you reference the state machine via pointer data member.
My code in the .mm file looks something like (with the FSM in a different .h file): @interface delegateThingy { Machine * stateMachine; } @end @implementation delegateThingy - (void)init { ... stateMachine = new Machine(); stateMachine->initiate(); ... } @end It fails to instantiate on the initiate call. I vaguely remember something about forcing an entire template to be instantiated in a translation unit. I guess I'll look it up in my reference manuals and see if that will help fix this problem. I appreciate the help.

I've played around with this even more. It compiles (as a .mm file) and
runs perfect in a Mac OS X project, but it has issues with the rebind
template when I try to compile the exact same file in an iPhone project.
However, I would think that if it is a C++ configuration issue then the
iPhone project would have the same issue trying to compile the FSM in a .cpp
file.
Any ideas?
On Thu, Jul 23, 2009 at 9:46 AM, Daniel Dilts
would really like the state
machine to be a member of an Objective C class.
This might work if you reference the state machine via pointer data member.
My code in the .mm file looks something like (with the FSM in a different .h file):
@interface delegateThingy { Machine * stateMachine; } @end
@implementation delegateThingy
- (void)init { ... stateMachine = new Machine(); stateMachine->initiate(); ... }
@end
It fails to instantiate on the initiate call. I vaguely remember something about forcing an entire template to be instantiated in a translation unit. I guess I'll look it up in my reference manuals and see if that will help fix this problem.
I appreciate the help.
participants (2)
-
Andreas Huber
-
Daniel Dilts