Click here to Skip to main content
11,436,925 members (63,070 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C Linux QT
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
Posted 18-Jun-12 21:56pm
Edited 18-Jun-12 22:07pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Should be:
void (CALLBACK *managedCallback1)(char **);
 
void (CALLBACK *managedStopCallback)();
The extra asterisk before the open parenthesis is incorrect.
  Permalink  
Comments
Arun Kumar K S at 19-Jun-12 3:54am
   
still same problem exist
Richard MacCutchan at 19-Jun-12 4:04am
   
Look at the other block of code posted above, you seem to be adding your indirection operators anywhere at random.
Arun Kumar K S at 19-Jun-12 3:58am
   
This is my running code on Visual studio. Its working perfectly on mu visual studio but not in Linux
Richard MacCutchan at 19-Jun-12 4:03am
   
I find that hard to believe.
Arun Kumar K S at 19-Jun-12 6:02am
   
I compiled it by removing CALLBACK but that not worked wirth my mono application as a callback
Richard MacCutchan at 19-Jun-12 7:55am
   
What is CALLBACK defined as?
Arun Kumar K S at 20-Jun-12 6:22am
   
#define CALLBACK __stdcall
its a calling convetion
Arun Kumar K S at 20-Jun-12 6:54am
   
Thanks to your help I solved it by removing CALLBACK and my running code is

void *( *managedCallback1)(char **);
void *( *managedStopCallback)();
Arun Kumar K S at 20-Jun-12 6:57am
   
My 5 to your valuable support
Richard MacCutchan at 20-Jun-12 9:11am
   
Happy to help & glad you got it solved.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.150428.2 | Last Updated 19 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100