Question

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

I also tried in pro file:

LIBS += -lkdeui

I still get problem KApplication not found

Code 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:

    TEMPLATE = app
    CONFIG += console
    CONFIG -= qt
    SOURCES += main.cpp
    LIBS += -lkdeui
Was it helpful?

Solution

You need to install development files for kde libraries, these are missing. I don't know which Linux distro you are using (if any) but, for example, in Debian the required package is called 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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top