qt - 使用QT 5.8 Ubuntu构建新应用程序的问题

标签 qt ubuntu compiler-errors

我已经使用QT的安装程序(在线版本1)在Ubuntu 16.04中安装了QT 5.8,安装完成后,我尝试使用MainWindow的基本代码创建一个GUI应用程序,该代码将您作为起点,但无法编译。

我在Windows 10和Zorin OS(基于Ubuntu的发行版)的另一台计算机上完成了完全相同的操作,并且运行完美。

尝试编译时出现以下错误:

18:37:57: Running steps for project aLAL...
18:37:57: Configuration unchanged, skipping qmake step.
18:37:57: Starting: "/usr/bin/make" 
g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../aLAL -I. -I/home/twistx77/Qt/5.8/gcc_64/include -I/home/twistx77/Qt/5.8/gcc_64/include/QtWidgets -I/home/twistx77/Qt/5.8/gcc_64/include/QtGui -I/home/twistx77/Qt/5.8/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I. -I/home/twistx77/Qt/5.8/gcc_64/mkspecs/linux-g++ -o main.o ../aLAL/main.cpp
In file included from /home/twistx77/Qt/5.8/gcc_64/include/QtCore/qcompilerdetection.h:996:0,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtCore/qglobal.h:97,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtGui/qtguiglobal.h:43,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtWidgets/qtwidgetsglobal.h:43,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtWidgets/qmainwindow.h:43,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtWidgets/QMainWindow:1,
                 from ../aLAL/mainwindow.h:4,
                 from ../aLAL/main.cpp:1:
/usr/include/c++/5/utility:213:5: error: ‘qtruct’ does not name a type
     qtruct _Build_index_tuple
     ^
/usr/include/c++/5/utility:219:12: error: ‘_Build_index_tuple’ is not a class template
     struct _Build_index_tuple<0>
            ^
/usr/include/c++/5/utility:220:5: error: explicit specialization of non-template ‘std::_Build_index_tuple’
     {
     ^
In file included from /usr/include/c++/5/bits/stl_map.h:63:0,
                 from /usr/include/c++/5/map:61,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtCore/qmetatype.h:55,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtCore/qobject.h:54,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtWidgets/qwidget.h:45,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtWidgets/qmainwindow.h:44,
                 from /home/twistx77/Qt/5.8/gcc_64/include/QtWidgets/QMainWindow:1,
                 from ../aLAL/mainwindow.h:4,
                 from ../aLAL/main.cpp:1:
/usr/include/c++/5/tuple:1074:29: error: ‘std::_Build_index_tuple’ is not a template
       typedef typename std::_Build_index_tuple<std::tuple_size<
                             ^
/usr/include/c++/5/tuple:1075:54: error: typedef name may not be a nested-name-specifier
  typename std::remove_reference<_Tp>::type>::value>::__type __type;
                                                      ^
/usr/include/c++/5/tuple:1075:54: error: expected ‘;’ at end of member declaration
/usr/include/c++/5/tuple:1075:61: error: declaration does not declare anything [-fpermissive]
  typename std::remove_reference<_Tp>::type>::value>::__type __type;
                                                             ^
/usr/include/c++/5/tuple: In constructor ‘std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>)’:
/usr/include/c++/5/tuple:1160:16: error: expected nested-name-specifier before ‘_Build_index_tuple’
       typename _Build_index_tuple<sizeof...(_Args1)>::__type(),
                ^
/usr/include/c++/5/tuple:1160:16: error: expected ‘(’ before ‘_Build_index_tuple’
/usr/include/c++/5/tuple:1161:16: error: expected nested-name-specifier before ‘_Build_index_tuple’
       typename _Build_index_tuple<sizeof...(_Args2)>::__type())
                ^
/usr/include/c++/5/tuple:1161:16: error: expected ‘(’ before ‘_Build_index_tuple’
Makefile:877: recipe for target 'main.o' failed
make: *** [main.o] Error 1
18:37:58: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project aLAL (kit: Desktop Qt 5.8.0 GCC 64bit)
When executing step "Make"
18:37:58: Elapsed time: 00:01.

我试图找到一种可以在Internet上找到解决方案的方法,但我无法弄清楚。

任何帮助,将不胜感激。

最佳答案

您的C++标准库 header utility似乎已损坏:

/usr/include/c++/5/utility:213:5: error: ‘qtruct’ does not name a type
     qtruct _Build_index_tuple

我会尝试在该文件中将qtruct更改为struct。或者您可以重新安装标准库

关于qt - 使用QT 5.8 Ubuntu构建新应用程序的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41900114/

相关文章:

c++ - 如何防止非事件 QMdiSubWindows 最大化

QT exe 文件似乎无法运行

c++ - 如何在 Qt-Creator (MacOs) 上链接 Qt API 和 GStreamer

linux - 在 Ubuntu 下启动/停止 .NET Core 应用程序

javascript - Hibernate,适用于 Windows,但不适用于 Linux。它复制表格并弄乱一些表格的名称

java - 在 Eclipse for Mac 上转换为 Dalvik 格式失败,出现错误 1

python - 从 Linux 中的 acpi 事件执行 PyQt 应用程序

bash - 在 bash 中绕过过滤 "."和 "space"

c++ - 为什么 g++ 在编译时给我冲突错误?

c++ - ASM 代码中对 C++ 变量的 undefined reference