How to Compile Qt(.cpp) file from command prompt
This article shows how to compile a Qt application from the command prompt. There are additional instructions in the Qt Reference.
- Download and install the Qt SDK
Procedure for compiling
- Open the Command prompt window for your target SDK from the Windows start bar, for example: Start | Qt SDK | Symbian~^3 | Qt 4.7.1 for Symbian^3 Command Prompt
- Using a basic command navigate to the directory that contains your .cpp file.
c:\> cd qt\examples\formlayout
- Give the command shown below. This command will automatically generate project file(.pro file)
c:\qt\examples\formlayout\> qmake -project
- If you use qmake to build your projects, it include the QtCore and QtGui by default. However, if you want to add only Qtcore module, add the folloing line to your .pro file. This is normally used in console application.
QT -= gui
- To add extra module like network,webkit,phonon etc. add following line to your .pro file
QT += network
- You can also add this line while creating a project file using qmake command.
c:\qt\examples\formlayout\> qmake -project QT+=network
- Now give the command to generate various make file
- Now give the following command
c:\qt\examples\formlayout\> make debug-gcce
- Note that the above command is actually a combination of two Symbian build toolchain commands:
bldmake bldfiles abld build gcce udeb
Creating a sisx file
- Following commands are use to create a self signed sis for the device.
make debug-gcce createpackage -i examplename_gcce-udeb.pkg