Build error: Previous declaration with C++ linkage; arduino

Discussion in 'Embedded Systems and Microcontrollers' started by Vindhyachal Takniki, Sep 5, 2015.

  1. Vindhyachal Takniki

    Thread Starter Member

    Nov 3, 2014
    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.