You copied the Doc URL to your clipboard.

ARM Compiler armclang Reference Guide : -MG


Prints dependency lines for header files even if the header files are missing.

Warning and error messages on missing header files are suppressed, and compilation continues.


The -MG option only has an effect when used with one of the following options: -M or -MM.


source.c contains a reference to a missing header file header.h:

#include <stdio.h>
#include "header.h"

int main(void){
	puts("Hello world\n");
	return 0;

This first example is compiled without the -MG option, and results in an error:

armclang --target=aarch64-arm-none-eabi -mcpu=cortex-a53 -M source.c
source.c:2:10: fatal error: 'header.h' file not found
#include "header.h"
1 error generated.

This second example is compiled with the -MG option, and the error is suppressed:

armclang --target=aarch64-arm-none-eabi -mcpu=cortex-a53 -M -MG source.c
source.o: source.c \
  /include/stdio.h \