title: Make / gcc cryptic error 2: how to have more information?
body: <p>I have this C++ project which compiles using a Makefile, and sometimes when (<em>my guess</em>) there are some missing includes, I get a cryptic "error 2" message and the make process stops.<br>
  I suspect the missing includes because this is the third times it happens when I included a non-existent header file.</p>
  
  <p>It looks like this:</p>
  
  <pre><code>---- Build tmp/foo.o ----
  ---- Build tmp/bar.o ----
  ---- Build tmp/toto.o ----
  ---- Build tmp/tata.o ----
  make: *** [build_Project] Error 2
  </code></pre>
  
  <p>This is driving me nuts, because even using verbose commands (where each g++ invocation is showed), I can't see anything.<br>
  I expected the guy to throw up some erroneous messages like "<em>can't find header X</em>" or "<em>undefined reference to Y</em>", but there's nothing.</p>
  
  <p>My compiling options for gcc are <code>-O0 -Wall -Werror -Wno-write-strings -fno-rtti -fno-exceptions</code>, if this helps.</p>
  
  <p>Ah, and we use the Makefile trick of including dependencies:</p>
  
  <pre><code>ifneq ($(strip $(DEPENDS)),)
  ifneq ($(MAKECMDGOALS),clean)
  -include $(DEPENDS)
  endif
  endif
  </code></pre>
  
  <p>( see <a href="https://stackoverflow.com/questions/1500715/gnu-makefile-handling-dependencies">here</a> and <a href="http://make.paulandlesley.org/autodep.html#advanced" rel="noreferrer">here</a> for more information )</p>
  
  <p>Although this is documented stuff, I suspect my problem has something to do with this dependencies inclusion.</p>
  
  <p>If you already stumbled on this issue, feel free to comment on this...</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>edit:</strong>
  Okay, after a bit of playing, suppressing the <code>-</code> in front of <code>-include $(DEPENDS)</code> gives me some more info (the makefile <em>does</em> stop on the missing included file). </p>
  
  <pre><code>make[1]: *** No rule to make target « foo.h », necessary for « tmp/bar.d ». Stop.
  </code></pre>
  
  <p>Now the drawback is that when I launch <code>make</code> for the first time, I get a <code>missing bar.d file</code> message for each dependency file that should be included (which was why we put the <code>-</code> in the first place).
  Any solution?</p>