gurmeetsingh
26th January 2012, 14:08
Hi,
I am new to Qt.
I have installed Qt_SDK_Lin32_offline_v1_1_2_en.run. It has installed successfuly.
When i have created Qt application from Qt IDE, it is building and running but same application is giving error when i try to compile it from terminal.
My code is
.pro file:
SOURCES = main.cpp
# install
sources.files = $$SOURCES *.pro
INSTALLS += target sources
DESTDIR = release
TARGET = Demo
main.cpp
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->setPixmap(QPixmap(200, 50));
label->show();
return app.exec();
}
but when i try to compile same project from command line using qmake and make command then it is giving following error.
$qmake
WARNING: target.path is not defined: install target not created
WARNING: sources.path is not defined: install target not created
$make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o main.o main.cpp
main.cpp:1:24: fatal error: QApplication: No such file or directory
compilation terminated.
make: *** [main.o] Error 1
I have compiled another project which is working fine in command line on another system with qmake and make. It is not giving any warning while qmake but giving same error while make.
.pro file for another project is
SOURCES = main.cpp
# install
target.path = Demo
sources.files = $$SOURCES *.pro
sources.path = .
INSTALLS += target sources
main.cpp is same for both.
Please help me to solve this.
Thanks
I am new to Qt.
I have installed Qt_SDK_Lin32_offline_v1_1_2_en.run. It has installed successfuly.
When i have created Qt application from Qt IDE, it is building and running but same application is giving error when i try to compile it from terminal.
My code is
.pro file:
SOURCES = main.cpp
# install
sources.files = $$SOURCES *.pro
INSTALLS += target sources
DESTDIR = release
TARGET = Demo
main.cpp
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->setPixmap(QPixmap(200, 50));
label->show();
return app.exec();
}
but when i try to compile same project from command line using qmake and make command then it is giving following error.
$qmake
WARNING: target.path is not defined: install target not created
WARNING: sources.path is not defined: install target not created
$make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o main.o main.cpp
main.cpp:1:24: fatal error: QApplication: No such file or directory
compilation terminated.
make: *** [main.o] Error 1
I have compiled another project which is working fine in command line on another system with qmake and make. It is not giving any warning while qmake but giving same error while make.
.pro file for another project is
SOURCES = main.cpp
# install
target.path = Demo
sources.files = $$SOURCES *.pro
sources.path = .
INSTALLS += target sources
main.cpp is same for both.
Please help me to solve this.
Thanks