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