我定義的一些信號:升壓信號和傳球類方法
typedef boost::signals2::signal<void (int temp)> SomeSig;
typedef SomeSig::slot_type SomeSigType;
我有一些類:
class SomeClass
{
SomeClass()
{
SomeSig.connect(&SomeClass::doMethod);
}
void doMethod(const SomeSig &slot);
};
,並得到了很多錯誤:
error: ‘BOOST_PP_ENUM_SHIFTED_PARAMS_M’ was not declared in this scope
error: ‘T’ was not declared in this scope
error: a function call cannot appear in a constant-expression
error: a function call cannot appear in a constant-expression
error: template argument 1 is invalid
error: ‘BOOST_SIGNALS2_MISC_STATEMENT’ has not been declared
error: expected identifier before ‘~’ token
error: expected ‘)’ before ‘~’ token
error: expected ‘;’ before ‘~’ token
UPD: 新代碼(相同錯誤):
typedef boost::signals2::signal<void (int keyCode)> SigKeyPressed;
typedef SigKeyPressed::slot_type SigKeyPressedType;
class SomeClass
{
SigKeyPressed mSigKeyPressed;
public:
SomeClass() { mSigKeyPressed.connect(&SomeClass::keyPressed); }
void keyPressed(const SigKeyPressedType &slot);
};
我已更新我的信息。仍然得到相同的錯誤。 – Ockonal 2010-06-15 17:38:13