QtWidgets/qwidget.h: No such file or directory



  • hi, Experts

    I'm a new to QT. Now I have met a problem when trying to build a simple program of cross-compile using xilinx arm compiler.

    My develop environment is VMware/Ubuntu16.04 environment.
    I haved installed QT-everywhere-5.4.2 and Qt creator 3.2.82(3.3.0-rc1 opensource), also I have configure the build environment of the Qt creator.
    0_1558090793644_0517-1.PNG
    0_1558090802972_0517-2.PNG 0_1558090809623_0517-3.PNG

    when I build a basic program, the error reported:

    18:19:27: Running steps for project hello_test...
    18:19:27: Starting: "/usr/local/bin/qmake" /home/mcggoal/hello_test/hello_test.pro -r -spec /usr/local/mkspecs/arm-xilinx-linux-gnueabi-g++ CONFIG+=debug
    18:19:27: The process "/usr/local/bin/qmake" exited normally.
    18:19:27: Starting: "/usr/bin/make"
    arm-xilinx-linux-gnueabi-g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../hello_test -I. -isystem /usr/local/include/QtWidgets -isystem /usr/local/include/QtGui -isystem /usr/local/include/QtCore -I. -I. -I/usr/local/mkspecs/arm-xilinx-linux-gnueabi-g++ -o main.o ../hello_test/main.cpp
    cc1plus: warning: include location "/usr/local/include/QtWidgets" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include/QtGui" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include/QtCore" is unsafe for cross-compilation [-Wpoison-system-directories]
    In file included from /usr/local/include/QtWidgets/QMainWindow:1:0,
    from ../hello_test/mainwindow.h:4,
    from ../hello_test/main.cpp:1:
    /usr/local/include/QtWidgets/qmainwindow.h:37:31: fatal error: QtWidgets/qwidget.h: No such file or directory
    #include <QtWidgets/qwidget.h>
    ^
    compilation terminated.
    Makefile:326: recipe for target 'main.o' failed
    make: *** [main.o] Error 1
    18:19:27: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project hello_test (kit: XLNX-GCC)
    When executing step "Make"
    18:19:27: Elapsed time: 00:00.

    but when I check the /usr/local/lib,QtWidgets/qwidget.h is just there, now I am confused and hoping someone to give some suggestions.
    Thanks!


  • Moderators

    @mcggoal
    in your .pro file did you add QT += widgets?



  • @raven-worx, thanks for quick response
    my .pro file is below, there is QT += widgets:

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = hello_test
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui


  • Qt Champions 2018

    @mcggoal Your Kit has a red exclamation mark. Put the mouse cursor there and see what it complains about.
    To be sure: your Qt in /usr/local is the one you cross compiled?


  • Qt Champions 2018

    @mcggoal

    1. If you really want to use such an old QtCreator version, you should at least update to the final or patch release (3.3.0 or better 3.3.1). I'd recommend updating to a recent one like 4.8.2

    You can use the old Qt version without problems with a new Creator version.

    1. your Kit is misconfigured, as the compiler says it sees a mix of native and cross Qt versions. Start investigation as @jsulm said.

    Did you setup this system following a tutorial?

    Regards



  • @jsulm
    The QT kit red mark is reported as "Mkspec not found for your QT version" , I set the Qt Mkspec as "/usr/local/mkspecs/arm-xilinx-linux-gnueabi-g++" , and this dir did exist there:
    0_1558316176296_0520-1.PNG

    Does it mean my QT version is not compatible with QT creator ?



  • @aha_1980
    I have updated QT creator to newest version 4.9.0.
    Also I have cleared all the red exclamation mark in kits tab.
    0_1558321106908_0520-2.PNG

    But the fault is still there:

    cc1plus: warning: include location "/usr/local/include/QtWidgets" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include/QtGui" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include/QtCore" is unsafe for cross-compilation [-Wpoison-system-directories]
    In file included from /usr/local/include/QtWidgets/QMainWindow:1:0,
    from ../hello_test/mainwindow.h:4,
    from ../hello_test/main.cpp:1:
    /usr/local/include/QtWidgets/qmainwindow.h:37:31: fatal error: QtWidgets/qwidget.h: No such file or directory
    #include <QtWidgets/qwidget.h>
    ^
    compilation terminated.
    Makefile:332: recipe for target 'main.o' failed
    make: *** [main.o] Error 1
    make: *** Waiting for unfinished jobs....
    10:54:35: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project hello_test (kit: XLNX-GCC)
    When executing step "Make"
    10:54:35: Elapsed time: 00:00.


  • Qt Champions 2018

    @mcggoal

    Did you setup this system following a tutorial?



  • @aha_1980
    first , I install QT 5.4.2-anywhere using the xilinx tutorial:
    https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842110/Qt+Qwt+Build+Instructions+Qt+5.4.2+Qwt+6.1.2

    Next , I install and configure the QT creator followed :
    https://www.ics.com/blog/configuring-qt-creator-raspberry-pi



  • @aha_1980 @jsulm @raven-worx
    thanks for your help, I reinstall the qt-anywhere according to xilinx, and this time the compilation is OK , although several warnnings for unsafe cross-compile as below:

    cc1plus: warning: include location "/usr/local/include/QtWidgets" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include/QtGui" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include/QtCore" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include/QtWidgets" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include/QtGui" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include/QtCore" is unsafe for cross-compilation [-Wpoison-system-directories]
    cc1plus: warning: include location "/usr/local/include" is unsafe for cross-compilation [-Wpoison-system-directories]


  • Qt Champions 2018

    @mcggoal Good! at least a step forward.

    Cross compilation is an advanced topic and needs quite some experience.

    Maybe someone else can help you better than me, but at least I've some questions for you:

    • Do you have another (native) Qt version on your system? If yes, where is it installed?
    • Do you call an environment-setup script to set-up your cross-compiler? Usually such scripts set the environment variables needed to find the compiler, the tools and also set up the sysroot for your embedded device.
    • Have you already verified that the files below /usr/local/lib are the cross-compiled ones? You can check with file libXXXX.so. That gives me the impression that the files are wrongly installed. Reason: /lib, /usr/lib, and /usr/local/lib are for native libraries, same applies for /bin, /usr/bin and /usr/local/bin for the binaries. Cross compiled binaries and should rather be installed in /opt or in your home directory.

    Regards


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.