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.
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! -
@mcggoal
in your .pro file did you addQT += 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 = appSOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h
FORMS += mainwindow.ui
-
- 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.
- 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:
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.
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. -
@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.2Next , 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] -
@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 withfile 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