Home/Support/Support Forum/Error : Need Function Definition or Deceleration
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Error : Need Function Definition or Deceleration

+1 vote
Hello All,

I am New to Rabbit and hence to Dynamic C development environment.

I am trying to compile the sample code below , but getting Need function definition and deceleration error / expected ) error! I would really appreciate if someone can help me through this.

#use BL26XX.lib
#use RNET.lib
#use RNET_AIN.lib

#define channel 2
#define gaincode 1;
#define MIN_VALUE 205
#define MAX_VALUE 1843
#define MIN_RANGE -2.50
#define MAX_RANGE 2.50

void main()
{

rn_AinData aindata;
int rc;

brdInit();

rc = rn_anaInCalib(channel, RNSINGLE, gaincode, MIN_VALUE, MIN_RANGE, MAX_VALUE, MAX_RANGE, &aindata); // function to calib rabbit net analog card.

}
asked Dec 22, 2017 in Rabbit Software by neerajrathi New to the Community (1 point)

Please log in or register to answer this question.

1 Answer

0 votes
You accidentally included a semicolon in your macro definition for `gaincode`. Also note that you should use all-uppercase names for your macros. Since Dynamic C won't actually compile rn_anaInCalib() until it reaches it in your code, the macros you're defining end up affecting that compilation. Since the function declaration uses "gaincode" and "channel" as variable names, it will replace them with "1" and "2" respectively and generate a compilation error.
Code:
#define gaincode 1;

Should be:
Code:
#define GAINCODE 1
answered Dec 26, 2017 by TomCollins Veteran of the Digi Community (1,752 points)
edited Dec 26, 2017 by TomCollins
...