PDA

View Full Version : KDE programming in C++


medions
01-02-2006, 10:17 AM
Hi all,

Can anyone tell me how I compile my C++ GUI program in KDE?

Here is my code:

#include <kapp.h>
#include <klocale.h>
#include <qpushbutton.h>

int main( int argc, char **argv )
{
KApplication a( argc, argv , "p2");

QPushButton *hello=new QPushButton( i18n("Hello World !"), 0 );
hello->setAutoResize( TRUE );

QObject::connect( hello, SIGNAL(clicked()), &a, SLOT(quit()) );

a.setMainWidget( hello );
hello->show();

return a.exec();
}

Charles
01-02-2006, 10:35 AM
In Kdevelop you have GCC integrated, so you can compile it quickly.

medions
01-02-2006, 11:50 AM
Hi Charles,

Well, I don't want to use KDevelop in the beginning, I want to know how it works from the bottom of it all.

Can you give me an example on how to do it?

Charles
01-02-2006, 01:17 PM
Then you could use gcc from the command line (I used to do it). You should do a man g++ to know how GCC works. It's not complicated ;)

medions
01-02-2006, 01:36 PM
Do you have the correct enviomentvariables for compiling?

Solarin
01-02-2006, 02:28 PM
If you're after QTDIR and QMAKESPEC then:

QTDIR = /usr/X11R6
QMAKESPEC = freebsd-g++

medions
01-02-2006, 04:44 PM
Hi Solarin,

Can you post a compiling line so I can get started?

Do I have to have anyting installed to get started?