Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

qt library

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
uki
Posts: 2
Joined: 2005-10-15 11:55

qt library

#1 Post by uki »

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??

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#2 Post by lacek »

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++.

Post Reply