在编译期间,无法找到QMainWindow

时间:2013-10-04 10:41:46

标签: c++ qt ubuntu qt4 cmake

我正在尝试编译cutecash(一个qt项目)并遇到一些麻烦。我只是在做标准:

cmake .
make

然而,我遇到的错误是无法找到QMainWindow和QString等等。这是错误:

http://pastebin.com/GGHTXE4N

In file included from /home/username/code/gnucash/src/gnc/fpo/ViewletView.hpp:14:0,
                 from /home/username/code/gnucash/src/gnc/fpo/FPO.hpp:4,
                 from /home/username/code/gnucash/src/gnc/fpo/moc_FPO.cxx:9:
/home/username/code/gnucash/src/gnc/mainwindow.hpp:26:23: fatal error: QMainWindow: No such file or directory
compilation terminated.
/home/username/code/gnucash/src/gnc/moc_RecentFileMenu.cxx:15:2: error: #error "This file was generated using the moc from 5.0.1. It"
/home/username/code/gnucash/src/gnc/moc_RecentFileMenu.cxx:16:2: error: #error "cannot be used with the include files from this version of Qt."
/home/username/code/gnucash/src/gnc/moc_RecentFileMenu.cxx:17:2: error: #error "(The moc has changed too much.)"
In file included from /home/username/code/gnucash/src/gnc/AccountItemModel.hpp:28:0,
                 from /home/username/code/gnucash/src/gnc/dashboard.hpp:34,
                 from /home/username/code/gnucash/src/gnc/moc_dashboard.cxx:9:
/home/username/code/gnucash/src/gnc/QofEventWrapper.hpp:37:19: fatal error: QString: No such file or directory
compilation terminated.
In file included from /home/username/code/gnucash/src/gnc/SplitListModel.hpp:29:0,
                 from /home/username/code/gnucash/src/gnc/moc_SplitListModel.cxx:9:
/home/username/code/gnucash/src/gnc/QofEventWrapper.hpp:37:19: fatal error: QString: No such file or directory
compilation terminated.

看似相当重要的东西:

error: #error "This file was generated using the moc from 5.0.1. It"
error: #error "cannot be used with the include files from this version of Qt."
error: #error "(The moc has changed too much.)"

因此,每当我尝试安装qt5-default(在ubuntu上)时,我必须删除qt4-default。如果我现在尝试编译,我会因为无法完成QMainWindow和其他一些部分(例如QAbstractItemDelegate)而遇到同样的问题。

我也收到这个警告:

#error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC or -fPIE."

除了一些新的错误之外,由于无法找到物品而出现这些错误。我在ubuntu 13.04上。

1 个答案:

答案 0 :(得分:1)

对我有用的步骤: