在Linux上编译函数指针 [英] Compile function pointer on Linux

查看:211
本文介绍了在Linux上编译函数指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用Qt和C作为编程语言在Linux中创建一个共享库.当我编译代码时,它会向我显示一个这样的错误

预期在"*"之前的)"

/home/arun/Documents/sFlowAnalyzingSampleInC#/sFlowLib/sFlowLib-build-desktop-Qt_4_8_2_in_PATH__System__Release/../sFlowLib/src/sflowtool.c:432:错误:在"*"令牌之前的预期)"


/home/arun/Documents/sFlowAnalyzingSampleInC#/sFlowLib/sFlowLib-build-desktop-Qt_4_8_2_in_PATH__System__Release/../sFlowLib/src/sflowtool.c:4467:错误:预期为)",位于"managedCallback"之前.



我的代码是

Hi,

I am creating one shared library in Linux using Qt and C as programming language. When i compile my code it show me one error like this

expected ‘)’ before ‘*’

/home/arun/Documents/sFlowAnalyzingSampleInC#/sFlowLib/sFlowLib-build-desktop-Qt_4_8_2_in_PATH__System__Release/../sFlowLib/src/sflowtool.c:432: error: expected ‘)’ before ‘*’ token


/home/arun/Documents/sFlowAnalyzingSampleInC#/sFlowLib/sFlowLib-build-desktop-Qt_4_8_2_in_PATH__System__Release/../sFlowLib/src/sflowtool.c:4467: error: expected ‘)’ before ‘managedCallback’



And my code is

void *(  CALLBACK *managedCallback1)(char **);
       void *(  CALLBACK *managedStopCallback)();







void StartCallback( void (* CALLBACK managedCallback(char **)))
{
        managedCallback1=managedCallback;

}

 void StopCallback( void (* CALLBACK managedCallback()))
{
        managedStopCallback=managedCallback;

}




我该如何解决这个问题




How I can solve this

推荐答案

应该是:
void (CALLBACK *managedCallback1)(char **);

void (CALLBACK *managedStopCallback)();


右括号前的多余星号不正确.


The extra asterisk before the open parenthesis is incorrect.


这篇关于在Linux上编译函数指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆