__stdcall typedef g ++问题 [英] __stdcall typedef g++ problem
本文介绍了__stdcall typedef g ++问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这段代码编译(如我所料):
This code compiles (as I would expect):
typedef void __stdcall (*Func)();
struct A {
static void __stdcall f() { }
};
int main() {
Func p = A::f;
}
但是这一个:
But this one:
struct A {
typedef void __stdcall (*Func)();
static void __stdcall f() { }
};
int main() {
A::Func p = A::f;
}
会失败并且不是非常有用的错误消息:
fails with not-very-helpful error message:
error: invalid conversion from `void (*)()' to `void (*)()'
我在Vista下使用g ++ 3.4.2(我知道,这很古老,但我现在无法访问任何其他环境) 。很明显,我在这里错过了一些东西。任何帮助将不胜感激。
I'm using g++ 3.4.2 under Vista (I know, it's ancient, but I don't have access to any other environment right now). Obviously I am missing something here. Any help would be appreciated.
推荐答案
语法是 void(__ stdcall *)()
,而不是 void __stdcall(*)()
。
这篇关于__stdcall typedef g ++问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文