g++ doesn't fail for non existing include files with -MMD but not with -MD
Jens Seidel
jensseidel@users.sf.net
Thu Nov 12 17:05:00 GMT 2009
Hi,
today I noticed that gcc doesn't stop with an error in all cases. Example:
$ cat test.cpp
#include <does_not_exist.h>
int main()
{
return 0;
}
$ g++ -c test.cpp -MD
test.cpp:1:28: error: does_not_exist.h: No such file or directory
This is expected. But using -MMD it outputs only a warning:
$ g++ -c test.cpp -MMD
test.cpp:1:28: warning: does_not_exist.h: No such file or directory
I noticed this problem because a project compiled fine in Eclipse (IIRC even
without warnings or I didn't noticed them) and failed with another build
system. Eclipse used -MMD beside other options, the other build system not :-))
Shouldn't gcc always complain with an error?
Version 4.3.4 and older are affected.
Jens
More information about the Gcc-help
mailing list