gcc can't find define in header
<p>I'm using a header called <code>lib.h</code> to organize my source code. The header is like:</p>

<pre><code>#define TOT_REP 10
#define TOT_PAT 10
#define TIME_REP 15
</code></pre>

<p>The source file include the header, but when i compile with gcc i'm getting this:</p>

<pre><code>error: ‘TIME_REP’ undeclared (first use in this function)
</code></pre>

<p>So i tried to compile with <code>gcc -E -dM</code> and i got something like this:</p>

<pre><code>...
#define SIGUSR2 12
#define TIME_REP 15
#define ____mbstate_t_defined 1
#define __SIGRTMIN 32
...
</code></pre>

<p>I also tried with <code>gcc -E</code>  and in the outuput i found that  the macro is properly replaced with its value.</p>

<p>What can I do to solve this?</p>

<p>EDIT: The code where TIME_REP is used is this:</p>

<pre><code>while((!ending|| *(shmAddress+0)!=0)&amp;&amp; quitSignal==0){

      totFolder=0;
      buf=(char*)calloc(2,sizeof(char));
      patientString=(char*)calloc(2,sizeof(char));

      sleep(TIME_REP); 
      while(read(fd,buf,sizeof(char))&gt;0){
         /*read from a file and get some data*/
      }
   }
</code></pre>

<p>EDIT 2: I tried to rename the lib.h and it seems to work now but i just can't understand why if with gcc -E -Dm  found the macro then i can't compile the code.</p>

<p>Anyway to answer to Woodrow Barlow:</p>

<p>i have the lib.h and a rep.c the rep.c include the lib.h and other headers:</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;sys/shm.h&gt;
#include &lt;unistd.h&gt;
#include &lt;string.h&gt;
#include "ReaderWriter.h"
#include "lib.h"
</code></pre>

<p>To compile I use <code>gcc rep.c -o rep -Wall -pedantic</code></p>