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