【发布时间】:2017-01-28 03:22:25
【问题描述】:
我已经使用 QT 的安装程序(在线安装程序)在 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.
我试图在互联网上寻找解决方案,但我无法弄清楚。
任何帮助将不胜感激。
【问题讨论】:
标签: qt ubuntu compiler-errors