Question

I have a main.c which call a function downsample which is defined in downMain.c

The prototype of downsample is

short int downsample(short int input);

In downMain.h i have this function prototype and downMain.c contains definition of the function.

I got below error when compiling

E:\demo\main.c(9) : error C2371: 'downsample' : redefinition; different basic types

Is it posible to return short int ? Why am i getting this error, solution please?!

EDit:


I include downMain.h in main.c

Content of downMain.c

int call_downsample(int key) {
  if(key == 1)
    downsample(data);
  return 0;
}

downsample function contains simple skip-copy for loop

content of downMain.h

int call_downsample(int key);
short int downsample(short int data);
Was it helpful?

Solution

The function downsample(data) is called with in the function call_downsample(int key) , so one thing to do is you have to define the function downsample(data) before it is called ,ie; above the function call_downsample(int key).

Refer to this link ,it describes the same problem Error C2371: redefinition; different basic types - why?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top