Build error: Previous declaration with C++ linkage

I am using arduino uno R3 with v1.6.5

  1. I have attached a code which has 4 .ino files & 6 headers.
    Setup is the main file which has loop & setup function.
    Here I have removed entire code, just put code which was giving error.

  2. Now if I go to key.h & uncomment static function prototype there,compiler through error. however if I uncomment it error goes & code works.

setup.ino:16:13: error: previous declaration of 'void get_key_number_if_valid()' with 'C++' linkage In file included from key.ino:5:0: C:\Users\abc\AppData\Local\Temp\build2487483355140505388.tmp\key.h:33:41: error: conflicts with new declaration with 'C' linkage static void get_key_number_if_valid(void); ^ previous declaration of 'void get_key_number_if_valid()' with 'C++' linkage

3.However in setup.ino, I have one static function do_nothiong(), which has function prototype in setup.h, but it don’t give any error there. (4.63 KB)

Is your project called "setup" ?
Is it to build a library ? Because you have too many includes.
You have your own int_types.h ? why ? and your own pin_defs ?
That can easily go wrong, because those files already exist.
You override certain types with typedef ? That is very dangerous.

The function "void init_all_vars__global_c(void)" is not used, so I can remove every prototyping for it.
I think the compiler gets confused when you combine normal function prototyping with 'extern' function prototyping for an empty function and don't even call that function.

Normally, you don't need 'extern' when referring to functions in your own project.

This is far too confusing for me. In the Arduino environment, almost everything is already declared and included.
You have to start small, with just the functions you need. The compiler will tell you if it is missing a variable type or a prototyping.

When you copy a file from a default included Arduino library, then you better rename the file, and rename every variable and every function and every function call in it.