title: "error: (1098) conflicting declarations" when function types changes
body: <p>I get conflicting declarations error when types of function is changed from int to void. The below code gives me error "TimerSetup.c:4: error: (1098) conflicting declarations for variable "_Timer1Init"". But the error vanish if function type of Timer1Init is changed to int in TimerSetup.h and TimerSetup.c file. Any Idea! Why?</p>
  
  <p><strong>TimerSetup.h</strong></p>
  
  <pre><code>// TimerSetup.h
  
      #ifndef XC_HEADER_TEMPLATE_H
          #define XC_HEADER_TEMPLATE_H
  
          #include &lt;xc.h&gt; // include processor files - each processor file is guarded.  
          #include &lt;stdint.h&gt;
  
          void Timer1Init();           //&lt;-----Error vanish when type changed to int
  
  
          #ifdef  __cplusplus
          extern "C" {
          #endif /* __cplusplus */
  
              // TODO If C++ is being used, regular C code needs function names to have C 
              // linkage so the functions can be used by the c code. 
  
          #ifdef  __cplusplus
          }
          #endif /* __cplusplus */
  
          #endif  /* XC_HEADER_TEMPLATE_H */
  </code></pre>
  
  <p><strong>TimerSetup.c</strong></p>
  
  <pre><code>#include &lt;xc.h&gt;
  #include "TimerSetup.h"
  
  void Timer1Init()             //&lt;-----Error vanish when type changed to int
  { 
      PIE1bits.TMR1IE=1;        
      PIR1bits.TMR1IF=0;   
  } 
  </code></pre>
  
  <p><strong>Wifi.c</strong></p>
  
  <pre><code>   #include &lt;xc.h&gt;
      #include "Wifi.h"
      void eUart1Init()
      {   
          TRISB=0;
          TRISC6=0;        /* Make Tx pin as output*/
          TRISC7=1;        /* Make Rx pin as input*/
          TXSTA1 = 0;
          TXSTA1bits.BRGH    = 1;                // high baud rate
          BAUDCON1bits.BRG16 = 0;
          BAUDCON1 = 0;
          PMD0 = 0;
  
          TXSTA1bits.TX9 = 0;
          TXSTA1bits.TXEN = 1;  
          TXSTA1bits.SENDB = 0;
          TXSTA1bits.BRGH = 1;
  
          RCSTA1bits.SPEN = 1;
          RCSTA1bits.RX9 = 0;
          RCSTA1bits.CREN = 1;
          RCSTA2bits.CREN = 1;
          SPBRG1 = 51;
  
          IPR1bits.TX1IP = 0;    // Interrupt priority bit
          PIR1bits.TX1IF = 0;
          PIE1bits.TX1IE = 1; 
  
          IPR1bits.RC1IP = 0;    // Interrupt priority bit /////////
          PIR1bits.RC1IF = 0;
          PIE1bits.RC1IE = 1; 
      }
      void eUart2Init()
      {   
          TRISB6=0;        /* Make Tx2 pin as output*/
          TRISB7=1;        /* Make Rx2 pin as input*/
          TXSTA2 = 0;
          TXSTA2bits.BRGH    = 1;                // high baud rate
          BAUDCON2bits.BRG16 = 0;
          BAUDCON2 = 0;
          //PMD0 = 0;
  
          TXSTA2bits.TX9 = 0;
          TXSTA2bits.TXEN = 1;  
          TXSTA2bits.SENDB = 0;
          TXSTA2bits.BRGH = 1;
  
          RCSTA2bits.SPEN = 1;
          RCSTA2bits.RX9 = 0;
          RCSTA2bits.CREN = 1;
          SPBRG2 = 51;
  
          IPR3bits.TX2IP = 0;    // Interrupt priority bit
          PIR3bits.TX2IF = 0;
          PIE3bits.TX2IE = 1; 
  
          IPR3bits.RC2IP = 0;    // Interrupt priority bit
          PIR3bits.RC2IF = 0;
          PIE3bits.RC2IE = 1; 
      }
      // EUART1 Put String Function Defines Here
      void eUart1Puts(const char *s)
      {
          while(*s)
              eUart1PutByte(*s++);
      }
      void eUart2Puts(const char *s)
      {
          while(*s)
              eUart2PutByte(*s++);
      }
      void eUart1PutByte(unsigned char byte)
      {
      while((PIR1bits.TX1IF != 1) &amp;&amp; (TXSTA1bits.TXEN1 != 0)) // set when register is empty
              continue;
          PIE1bits.TX1IE = 1;
          TXREG1 = byte;
      }
      void eUart2PutByte(unsigned char byte)
      {
      while((PIR3bits.TX2IF != 1) &amp;&amp; (TXSTA2bits.TXEN2 != 0)) // set when register is empty
              continue;
          PIE1bits.TX1IE = 1;
          TXREG2 = byte;
      }
      void WifiAT(char *command)
      {
          eUart1Puts(command);
          //__delay_ms(wifi_wait);
          while (eusart_rx_buffer_rd != eusart_rx_buffer_wr) 
              {   // While there's data in the buffer
                  eUart2PutByte(eusart_rx_buffer[eusart_rx_buffer_rd++]);   // Do something with it
  
                  if (eusart_rx_buffer_rd &gt;= EUSART_BUFFER_SIZE)     // Increase read pointer
                  {
                      eusart_rx_buffer_rd = 0;
                  }
              }            
      }
      __interrupt() void ISR(void)             //&lt;----------------------- To here
      {
          if((PIR3bits.TX2IF == 1) &amp;&amp; (PIE3bits.TX2IE == 1))  //Debug Terminal Tx  
          {
              PIR3bits.TX2IF = 0;
              PIE3bits.TX2IE = 0;
          }
  
          if((PIR3bits.RC2IF != 0) &amp;&amp; (PIE3bits.RC2IE != 0))  //Debug Terminal Rx
          {         
              PIR3bits.RC2IF = 0;
              rc2_data = RCREG2;      
          }
  
          if((PIR1bits.TX1IF != 0) &amp;&amp; (PIE1bits.TX1IE != 0))        
          {
              PIR1bits.TX1IF = 0;
              PIE1bits.TX1IE = 0;
          }
  
          if((PIR1bits.RC1IF != 0) &amp;&amp; (PIE1bits.RC1IE != 0))
          {         
      //      rc_data = RCREG1;
      //      eUart2PutByte(rc_data);
  
              eusart_rx_buffer[eusart_rx_buffer_wr++] = RCREG1;  // Store the received data
  
              if (eusart_rx_buffer_wr &gt;= EUSART_BUFFER_SIZE)    // Increment write pointer
              {
                  eusart_rx_buffer_wr = 0;
              }
  
              PIR1bits.RC1IF = 0;
          }
  
      //    if((PIR1bits.TMR1IF != 0) &amp;&amp; (PIE1bits.TMR1IE != 0))
      //    {
      //        int flag = 0;
      //        TMR1=0xF856;
      //        if(flag &gt;= 1000)
      //        {
      //            PORTCbits.RC1 = ~(PORTCbits.RC1);
      //            PIR1bits.TMR1IF=0;  /* Make Timer1 Overflow Flag to '0' */   
      //        }
      //    }
      }
  </code></pre>
  
  <p><strong>TokMain.c</strong></p>
  
  <pre><code>    #include &lt;xc.h&gt;
  #include "Wifi.h"
  
  void eUart1Init()
  {   
      TRISB=0;
      TRISC6=0;        /* Make Tx pin as output*/
      TRISC7=1;        /* Make Rx pin as input*/
      TXSTA1 = 0;
      TXSTA1bits.BRGH    = 1;                // high baud rate
      BAUDCON1bits.BRG16 = 0;
      BAUDCON1 = 0;
      PMD0 = 0;
  
      TXSTA1bits.TX9 = 0;
      TXSTA1bits.TXEN = 1;  
      TXSTA1bits.SENDB = 0;
      TXSTA1bits.BRGH = 1;
  
      RCSTA1bits.SPEN = 1;
      RCSTA1bits.RX9 = 0;
      RCSTA1bits.CREN = 1;
      RCSTA2bits.CREN = 1;
  
      SPBRG1 = 51;
  
      IPR1bits.TX1IP = 0;    // Interrupt priority bit
      PIR1bits.TX1IF = 0;
      PIE1bits.TX1IE = 1; 
  
      IPR1bits.RC1IP = 0;    // Interrupt priority bit /////////
      PIR1bits.RC1IF = 0;
      PIE1bits.RC1IE = 1; 
  }
  
  void eUart2Init()
  {   
      TRISB6=0;        /* Make Tx2 pin as output*/
      TRISB7=1;        /* Make Rx2 pin as input*/
      TXSTA2 = 0;
      TXSTA2bits.BRGH    = 1;                // high baud rate
      BAUDCON2bits.BRG16 = 0;
      BAUDCON2 = 0;
      //PMD0 = 0;
  
      TXSTA2bits.TX9 = 0;
      TXSTA2bits.TXEN = 1;  
      TXSTA2bits.SENDB = 0;
      TXSTA2bits.BRGH = 1;
  
      RCSTA2bits.SPEN = 1;
      RCSTA2bits.RX9 = 0;
      RCSTA2bits.CREN = 1;
  
      SPBRG2 = 51;
  
      IPR3bits.TX2IP = 0;    // Interrupt priority bit
      PIR3bits.TX2IF = 0;
      PIE3bits.TX2IE = 1; 
  
      IPR3bits.RC2IP = 0;    // Interrupt priority bit
      PIR3bits.RC2IF = 0;
      PIE3bits.RC2IE = 1; 
  }
  // EUART1 Put String Function Defines Here
  void eUart1Puts(const char *s)
  {
      while(*s)
          eUart1PutByte(*s++);
  }
  
  void eUart2Puts(const char *s)
  {
      while(*s)
          eUart2PutByte(*s++);
  }
  
  void eUart1PutByte(unsigned char byte)
  {
  while((PIR1bits.TX1IF != 1) &amp;&amp; (TXSTA1bits.TXEN1 != 0)) // set when register is empty
          continue;
      PIE1bits.TX1IE = 1;
      TXREG1 = byte;
  }
  
  void eUart2PutByte(unsigned char byte)
  {
  while((PIR3bits.TX2IF != 1) &amp;&amp; (TXSTA2bits.TXEN2 != 0)) // set when register is empty
          continue;
      PIE1bits.TX1IE = 1;
      TXREG2 = byte;
  }
  
  void WifiAT(char *command)
  {
      eUart1Puts(command);
      //__delay_ms(wifi_wait);
      while (eusart_rx_buffer_rd != eusart_rx_buffer_wr) 
          {   // While there's data in the buffer
              eUart2PutByte(eusart_rx_buffer[eusart_rx_buffer_rd++]);   // Do something with it
  
              if (eusart_rx_buffer_rd &gt;= EUSART_BUFFER_SIZE)     // Increase read pointer
              {
                  eusart_rx_buffer_rd = 0;
              }
          }            
  }
  
  __interrupt() void ISR(void)             //&lt;----------------------- To here
  {
      if((PIR3bits.TX2IF == 1) &amp;&amp; (PIE3bits.TX2IE == 1))  //Debug Terminal Tx  
      {
          PIR3bits.TX2IF = 0;
          PIE3bits.TX2IE = 0;
      }
  
      if((PIR3bits.RC2IF != 0) &amp;&amp; (PIE3bits.RC2IE != 0))  //Debug Terminal Rx
      {         
          PIR3bits.RC2IF = 0;
          rc2_data = RCREG2;      
      }
  
      if((PIR1bits.TX1IF != 0) &amp;&amp; (PIE1bits.TX1IE != 0))        
      {
          PIR1bits.TX1IF = 0;
          PIE1bits.TX1IE = 0;
      }
  
      if((PIR1bits.RC1IF != 0) &amp;&amp; (PIE1bits.RC1IE != 0))
      {         
  //      rc_data = RCREG1;
  //      eUart2PutByte(rc_data);
  
          eusart_rx_buffer[eusart_rx_buffer_wr++] = RCREG1;  // Store the received data
  
          if (eusart_rx_buffer_wr &gt;= EUSART_BUFFER_SIZE)    // Increment write pointer
          {
              eusart_rx_buffer_wr = 0;
          }
  
          PIR1bits.RC1IF = 0;
      }
  
  //    if((PIR1bits.TMR1IF != 0) &amp;&amp; (PIE1bits.TMR1IE != 0))
  //    {
  //        int flag = 0;
  //        TMR1=0xF856;
  //        if(flag &gt;= 1000)
  //        {
  //            PORTCbits.RC1 = ~(PORTCbits.RC1);
  //            PIR1bits.TMR1IF=0;  /* Make Timer1 Overflow Flag to '0' */   
  //        }
  //    }
  }
  </code></pre>
  
  <p><strong>Wifi.h</strong></p>
  
  <pre><code>// This is a guard condition so that contents of this file are not included
  // more than once.  
  #ifndef XC_HEADER_TEMPLATE_H
  #define XC_HEADER_TEMPLATE_H
  
  #include &lt;xc.h&gt; // include processor files - each processor file is guarded.  
  #include &lt;stdint.h&gt;
  
  #define _XTAL_FREQ 8000000UL
  #define EUSART_BUFFER_SIZE 1024
  
  char rc2_data; 
  char rc_data;
  
  char eusart_rx_buffer[EUSART_BUFFER_SIZE];   // the actual buffer, now 2048 bytes long
  uint16_t eusart_rx_buffer_rd = 0;            // the current read position
  uint16_t eusart_rx_buffer_wr = 0;            // the current write position
  
  void eUart1Init();
  void eUart2Init();
  void eUart1PutByte(unsigned char byte);
  void eUart2PutByte(unsigned char byte);
  void eUart1Puts(const char *s);
  void eUart2Puts(const char *s);
  void WifiAT(char *command);
  
  
  // TODO Insert declarations or function prototypes (right here) to leverage 
  // live documentation
  
  #ifdef  __cplusplus
  extern "C" {
  #endif /* __cplusplus */
  
      // TODO If C++ is being used, regular C code needs function names to have C 
      // linkage so the functions can be used by the c code. 
  
  #ifdef  __cplusplus
  }
  #endif /* __cplusplus */
  
  #endif  /* XC_HEADER_TEMPLATE_H */
  </code></pre>
  
  <p><strong>Full error Message:</strong></p>
  
  <pre><code>make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
  make[1]: Entering directory 'E:/pk/TokenOverWiFi.X'
  make  -f nbproject/Makefile-default.mk dist/default/production/TokenOverWiFi.X.production.hex
  make[2]: Entering directory 'E:/pk/TokenOverWiFi.X'
  "C:\Program Files (x86)\Microchip\xc8\v1.44\bin\xc8.exe" --pass1  --chip=18F25K80 -Q -G  --double=24 --float=24 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default  --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib   --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s"     -obuild/default/production/TokMain.p1 TokMain.c 
  TokMain.c:81: warning: (361) function declared implicit int
  "C:\Program Files (x86)\Microchip\xc8\v1.44\bin\xc8.exe"  --chip=18F25K80 -G -mdist/default/production/TokenOverWiFi.X.production.map  -DXPRJ_default=default  --double=24 --float=24 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s"      --memorysummary dist/default/production/memoryfile.xml -odist/default/production/TokenOverWiFi.X.production.elf  build/default/production/TokMain.p1 build/default/production/Wifi.p1 build/default/production/TimerSetup.p1     
  Microchip MPLAB XC8 C Compiler (Free Mode) V1.44
  Build date: Sep 13 2017
  Part Support Version: 1.44
  Copyright (C) 2017 Microchip Technology Inc.
  License type: Node Configuration
  
  :: warning: (1273) Omniscient Code Generation not available in Free mode
  TimerSetup.c:4: error: (1098) conflicting declarations for variable "_Timer1Init" (TokMain.c:81)
  make[2]: *** [dist/default/production/TokenOverWiFi.X.production.hex] Error 1
  make[1]: *** [.build-conf] Error 2
  make: *** [.build-impl] Error 2
  (908) exit status = 1
  nbproject/Makefile-default.mk:163: recipe for target 'dist/default/production/TokenOverWiFi.X.production.hex' failed
  make[2]: Leaving directory 'E:/pk/TokenOverWiFi.X'
  nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
  make[1]: Leaving directory 'E:/pk/TokenOverWiFi.X'
  nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
  
  BUILD FAILED (exit value 2, total time: 805ms)
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>The code compiles successfully when I comment out my other header file. How?? </p>