我正在尝试编译cutetcash(一个qt项目)并且遇到了一些麻烦。我只是在做标准:
cmake .
make
但是,我收到有关无法找到 QMainWindow 和 QString 等错误。这是错误:
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。