gpt4 book ai didi

C++/编译程序 fatal error : QtGui/qwidget. h: No such file or directory

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:17:57 25 4
gpt4 key购买 nike

我下载了一个需要 qt4 的 linux 应用程序。我已经在我的电脑上了。

当我想在终端中使用 ma​​ke 编译程序时出现以下错误。

[  6%] Building CXX object CMakeFiles/util_convert.dir/moc_planeviewer.cxx.o
In file included from /usr/include/qt4/QtGui/QMainWindow:1:0,
from /home/Desktop/plane/src/planeviewer.h:3,
from /home/Desktop/plane/src/moc_planeviewer.cxx:9:
/usr/include/qt4/QtGui/qmainwindow.h:45:27: fatal error: QtGui/qwidget.h: No such file or directory
#include <QtGui/qwidget.h>
^
compilation terminated.
make[2]: *** [CMakeFiles/util_convert.dir/moc_planviewer.cxx.o] Error 1
make[1]: *** [CMakeFiles/util_convert.dir/all] Error 2
make: *** [all] Error 2

我不明白,因为我已经检查了所有内容。对于这些不同的命令行,我有以下输入:

qmake --version

QMake version 2.01a
Using Qt version 4.8.6 in /usr/lib/x86_64-linux-gnu

找到 qwidget.h

/opt/qt/5.4/android_armv7/include/QtWidgets/qwidget.h
/opt/qt/5.4/gcc_64/include/QtWidgets/qwidget.h
/usr/include/qt4/Qt/qwidget.h
/usr/include/qt4/QtGui/qwidget.h

所以文件已经存在。

案例中的 CmakeList

find_package(Boost 1.58 REQUIRED COMPONENTS serialization program_options python)
find_package(PythonLibs 2.6 REQUIRED)

set(QT_USE_QTSVG TRUE)
set(QT_USE_QTXML TRUE)
set(QT_USE_QTOPENGL TRUE)
find_package(OpenGL)
find_package( Qt4 REQUIRED )

INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_PATH}")
INCLUDE_DIRECTORIES(${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTSVG_INCLUDE_DIR}
${QT_QTXML_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS})

QT4_WRAP_UI(util_convert_FORMS planeviewer.ui)
QT4_WRAP_CPP(util_convert_MOCS planeviewer.h planewidget.h)
ADD_EXECUTABLE(util_convert ${util_convert_FORMS} ${util_convert_MOCS} plane.cpp util_convert.cpp planeviewer.cpp planewidget.cpp objects.cpp coordinates.cpp utils.cpp)
TARGET_LINK_LIBRARIES(util_convert ${Boost_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTSVG_LIBRARY}
${QT_QTXML_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_LIBRARIES})

我是如何编译的:

转到 src/然后执行 cmake .,最后 ma​​ke。错误发生在 make 步骤。

在发布之前,我已经在互联网上进行了搜索,但还没有找到解决方案。

有人可以帮助我吗?

最佳答案

问题出在INCLUDE_DIRECTORIES .我认为在你的例子中 QT_QTGUI_INCLUDE_DIR变量的值为 /usr/include/qt4/QtGui , 但你需要添加 /usr/include/qt4INCLUDE_DIRECTORIES ,因为在代码中包含语句使用路径 <QtGui/qwidget.h> :

INCLUDE_DIRECTORIES("/usr/include/qt4")

关于C++/编译程序 fatal error : QtGui/qwidget. h: No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30770696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com