gcc error output format

When compiling, gcc may output many error messages which are dazzling. Although you can locate the error in the source code in the end, you may never notice the details of the error output format. For example,

In file included from C:\Qt\Qt5.12.1\5.12.1\Src\qtbase\include/QtGui/qopengl.h:1:0,
                 from C:/Qt/Qt5.12.1/5.12.1/Src/qtbase/src/gui/kernel/qopenglcontext.h:60,
                 from C:\Qt\Qt5.12.1\5.12.1\Src\qtbase\include/QtGui/qopenglcontext.h:1,
                 from C:/Qt/Qt5.12.1/5.12.1/Src/qtbase/src/gui/kernel/qplatformintegration.h:56,
                 from C:\Qt\Qt5.12.1\5.12.1\Src\qtbase\include\QtGui\5.12.1\QtGui/qpa/qplatformintegration.h:1,
                 from C:\Qt\Qt5.12.1\5.12.1\Src\qtbase\src\gui\accessible\qaccessible.cpp:52:
C:/Qt/Qt5.12.1/5.12.1/Src/qtbase/src/gui/opengl/qopengl.h:111:13: fatal error: GLES2/gl2.h: No such file or directory
 #   include <GLES2/gl2.h>
             ^~~~~~~~~~~~~
compilation terminated.

How to interpret the error messages? An easy to understand error message would be :

In file C:/Qt/Qt5.12.1/5.12.1/Src/qtbase/src/gui/opengl/qopengl.h:111:13 that is included from C:\Qt\Qt5.12.1\5.12.1\Src\qtbase\include/QtGui/qopengl.h:1:0,
                 from C:/Qt/Qt5.12.1/5.12.1/Src/qtbase/src/gui/kernel/qopenglcontext.h:60,
                 from C:\Qt\Qt5.12.1\5.12.1\Src\qtbase\include/QtGui/qopenglcontext.h:1,
                 from C:/Qt/Qt5.12.1/5.12.1/Src/qtbase/src/gui/kernel/qplatformintegration.h:56,
                 from C:\Qt\Qt5.12.1\5.12.1\Src\qtbase\include\QtGui\5.12.1\QtGui/qpa/qplatformintegration.h:1,
                 from C:\Qt\Qt5.12.1\5.12.1\Src\qtbase\src\gui\accessible\qaccessible.cpp:52:
: fatal error: GLES2/gl2.h: No such file or directory
 #   include <GLES2/gl2.h>
             ^~~~~~~~~~~~~
compilation terminated.

gcc arranges the file that the error occurs at the bottom while the files including the error file on the top. The inclusion order is reverse, i.e., the former file is included by the latter file. But the last included file(the error file) is put at last. 111:13 means the 111th line and the 13th column of the source code. Line number starts from 1 and column number also begins from 1. The actual error information follows the file names and the complete line of source code that the error occurs follows the actual error description.

 

If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!

Leave a Reply