How to Compile Qt(.cpp) file from command prompt

From Qt Wiki
Jump to navigation Jump to search

Template:Abstract

Template:ArticleMetaData

Preconditions[edit | edit source]

  • Download and install the Qt SDK

Procedure for compiling[edit | edit source]

  • 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
 c:\qt\examples\formlayout\> qmake
  • 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[edit | edit source]

  • Following commands are use to create a self signed sis for the device.
 make debug-gcce
 createpackage -i examplename_gcce-udeb.pkg


pt:Compilando um projeto Qt via linha de comando