Important: Please read the Qt Code of Conduct -

[Solved] Why the compiler can't search the sub-dir of the standard include-search-path?

  • Hi, every one!
    I'm just building Qt 5.4.1 with MinGW 4.9.2 in MSYS2. for the support of glib, I download the glib library of MinGW in MSYS2, and install it in the MinGW's default include-and-library paths with MSYS2(/MinGW64/include and /MinGW64/lib). But after installing library, the header and library files of glib are stored in a sub-dir which is named with 'glib-2.0' of every include and library dirs.
    While compiling the Qt, I passed the parameters to ./configure like this:

    -opensource -glib -I ./glib-2.0 -L ./glib-2.0

    But when compiling, I got the following error message :

    In file included from glib.cpp:36:0:
    C:/Qt/msys64/mingw64/include/glib-2.0/glib.h:31:25: fatal error: glib/garray.h: No such file or directory
    #include <glib/garray.h>
    compilation terminated.
    Makefile:161: recipe for target 'glib.o' failed
    make: *** [glib.o] Error 1
    Glib disabled.
    Glib support cannot be enabled due to functionality tests!
    Use of pkg-config is not enabled, maybe you want to pass -force-pkg-config?
    Turn on verbose messaging (-v) to /d/myprojects/qtc/src/qtbase/configure to see the final report.
    switch (-continue) to /d/myprojects/qtc/src/qtbase/configure to continue.

    I have checked the dir /MinGW64/include, and found the file 'garray.h' and many other header files are stored in dir 'glib-2.0/glib/'. So I thought the compiler should be able to find the specified file. But why it can't ? and how to resolve it ?

  • Moderators

    Are you sure './' in your include paths (-I and -L) is the right directory to start in?

  • @sierdzio Thanks for your replying!
    Actually, I'm not sure './' is correct. But if I doesn't pass parameters to ./configure with '-I ./glib-2.0' like above mentioned, I'll got an error message that says 'can not find glib.h: No such file or directory'. So I think './' should worked, as descripted above , partially.
    So, what's wrong with it? Can you help me? Thx.

  • Moderators

    './' means "current directory", so the directory where you run configure. This is probably the same directory where your Qt source code is located - it does not contain glib. So I would advise to pass a proper, non-relative path to glib there instead.

  • @sierdzio Thx! I've tested on replacing full path to '-I' option with './' as you memtioned, and it worked well ^-^! Thank you very much!

  • Moderators

    You are welcome. Happy coding

Log in to reply