title: C, #include and #define override
body: <p>I have a library as this:</p>
  
  <pre><code>mylib
    |__ device
          |__ lcd.h
          |__ lcd_config.h
          |__ lcd.c
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// File lcd.h
  #include lcd_config.h
  
  void function initLcd();
  void function writeLcd();
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// File lcd.c
  #include lcd.h
  
  void function writeLcd(){
       // some code
  }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// File lcd_config.h inside mylib
  #ifndef lcd_config_H
  #define lcd_config_H
  
  #define TEST 10
  
  #endif
  </code></pre>
  
  <p>I want to use the library in a project, but I want to redefine the configuration file.</p>
  
  <pre><code>myproject
      |__ lcd_config.h
      |__ mylcd.c
      |__ main.c
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// File lcd_config.h inside myproject(at main.c level)
  #ifndef lcd_config_H
  #define lcd_config_H
  
  #define TEST 20
  
  #endif
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// File mylcd.c
  #include lcd.h
  
  void function initLcd(){
       printf("%d", TEST);
  }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// File main.c
  #include "device/lcd.h"
  
  int main(void) {
      initLcd(); // print 10
  }
  </code></pre>
  
  <p>.</p>
  
  <pre><code>// File main1.c
  #include "lcd_config.h"
  #include "device/lcd.h"
  
  int main(void) {
      initLcd(); // print 10 too
  }
  </code></pre>
  
  <p>In my project i want that TEST = 20,  how can i achieve this?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Look at file now, this is my real case.</p>
  
  <p>To print TEST=20 i have to put <code>#include lcd_config.h</code> before <code>#include lcd.h</code> inside <code>mylcd.c</code>.
  If i put it in main file(like main1.c) 10 will be print, s i think preprocessing look before inside mylcd.h that main.c.</p>
  
  <p>Thanks</p>