[英]Hello World for KDE in Qtcreator
I have just begun programming for KDE, the problem I face is I don't know what exactly should be the pro file for a KDE project, I have an idea for cmake though 我刚刚开始为KDE编程,我面临的问题是我不知道KDE项目的专业文件到底应该是什么,尽管我有一个cmake的想法
I also tried in pro file: 我也在pro文件中尝试过:
LIBS += -lkdeui LIBS + = -lkdeui
I still get problem KApplication not found 我仍然遇到问题KApplication找不到
Code main.cpp: 代码main.cpp:
#include <cstdlib>
#include <KApplication>
#include <KAboutData>
#include <KCmdLineArgs>
#include <KMessageBox>
#include <KLocale>
int main (int argc, char *argv[])
{
KAboutData aboutData("tutorial1",0,ki18n("Tutorial 1"),"1.0",ki18n("Displays a KMessageBox popup"),KAboutData::License_GPL,ki18n("(c) 2007"),ki18n("Some text..."),"http://example.com/","submit@bugs.kde.org");
KCmdLineArgs::init( argc, argv, &aboutData );
KApplication app;
KGuiItem yesButton( i18n( "Hello" ), QString(),
i18n( "This is a tooltip" ),
i18n( "This is a WhatsThis help text." ) );
return
KMessageBox ::questionYesNo
(0, i18n( "Hello World" ), i18n( "Hello" ), yesButton )
== KMessageBox ::Yes? EXIT_SUCCESS: EXIT_FAILURE;
}
and tutorial.pro file is: 而tutorial.pro文件是:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
LIBS += -lkdeui
You need to install development files for kde libraries, these are missing. 您需要为kde库安装开发文件,但缺少这些文件。 I don't know which Linux distro you are using (if any) but, for example, in Debian the required package is called kdelibs5-dev .
我不知道您正在使用哪个Linux发行版(如果有),例如,在Debian中,所需的软件包称为kdelibs5-dev 。
You will probably also need to specify the include path for these development files after installing the package. 安装软件包后,您可能还需要为这些开发文件指定包含路径。 Like
INCLUDEPATH += /usr/include/KDE
像
INCLUDEPATH += /usr/include/KDE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.