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

时间:2017-01-27 17:53:00

标签: qt ubuntu compiler-errors

我已经使用QT的安装程序(在线版)在Ubuntu 16.04中安装了QT 5.8,并且一旦安装,我尝试使用MainWindow的基本代码创建一个GUI应用程序,它将它作为一个起点,但它没有& #39; t compile。

我在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.

我试图在互联网上寻找解决方案,但我无法弄明白。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

看起来您的C ++标准库标头utility已损坏:

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

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