qt library

Need help with C, C++, perl, python, etc?

qt library

Postby uki » 2005-10-15 12:05

Hi
I'm trying to learn programing with qt library.
When trying to compile simple program like :
Code: Select all
#include <qapplication.h>
#include <qpushbutton.h>

int main( int argc, char **argv )
{
    QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
    hello.resize( 100, 30 );
a.setMainWidget( &hello );
    hello.show();
    return a.exec();
}




I get an error which is:
Code: Select all
/usr/bin/ld: cannot find -lqt
collect2: ld returned 1 exit status


I compile the code with script ./compile hello
and the script look like:

Code: Select all
#! /bin/bash
#############################################
#
# A script to compile qt programs. To compile,
# enter: ./compile cpp_name without the '.cc'.
# To run the program: ./name [ -style=windows||platinum ]
#
#############################################

QTDIR="/usr/include/qt3";

CPP_FILE=$1;

########## COMPILE CODE HERE ##############

g++ -c -I${QTDIR} $CPP_FILE.cc;
g++ -o $CPP_FILE $CPP_FILE.o -L${QTDIR} -lqt;


Does anyone has an idea??
uki
 
Posts: 2
Joined: 2005-10-15 11:55

Postby lacek » 2005-10-21 15:36

First, if you have KDE installed, you probably have the multithreaded QT library. If so, you should use -lqt-mt instead of -lqt. Secont, you should export QTDIR to point to /usr/share/qt3, and add the -I$QTDIR/include switch to g++.
lacek
Moderator Team Member
 
Posts: 769
Joined: 2004-03-11 18:49
Location: Budapest, Hungary


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable