User Tools

Site Tools


qt:pro_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
qt:pro_files [2010/12/07 19:39] – [Description] mithatqt:pro_files [2010/12/08 19:44] (current) mithat
Line 2: Line 2:
  
 ===== Description ===== ===== Description =====
-For every Qt project there is a ''*.pro'' file in the project directory that describes the project to [[qmake]]. This file takes its name from the project directory. To create a ''{directory-name}.pro'' file in a project directory, run <code bash>qmake -project</code> in a terminal shell. If there are any files in the directory when the above is run, those files will be included in ''{directory-name}.pro''.+For every Qt project there is a ''*.pro'' file in the project directory that describes the project to [[qmake]]. The file takes its name from the project directory.
  
-Typically a ''*.pro'' file is created once in a project's lifetime and then is edited to reflect configuration options, the additional of code files, etc.+The project'''{directory-name}.pro'' file is typically created once in a project's lifetime and then edited to reflect configuration options, the addition of code files, etc.
  
 ===== Syntax ===== ===== Syntax =====
Line 14: Line 14:
  
 ===== File creation ===== ===== File creation =====
 +To create a ''{directory-name}.pro'' file in a project directory, run <code bash>qmake -project</code> in a terminal shell. If there are any source or other project files in the directory when the above is run, those files will be automatically included in ''{directory-name}.pro''.
  
-A virgin ''*.pro'' file in virgin directory:<code bash> +Running ''qmake -project'' when there is at least a ''main.cpp'' (or similar) file will greatly simplify future modifications. Here is a virgin ''*.pro'' file for a directory that has ''main.cpp'' in it (where main.cpp is a Qt application):<code bash>
-###################################################################### +
-# Automatically generated by qmake (2.01a) Tue Dec 7 17:07:32 2010 +
-###################################################################### +
- +
-TEMPLATE = subdirs +
- +
-# Directories +
-</code> +
- +
-virgin ''*.pro'' file in a directory that has main.cpp in it (where main.cpp is a Qt application):<code bash>+
 ###################################################################### ######################################################################
 # Automatically generated by qmake (2.01a) Tue Dec 7 17:15:59 2010 # Automatically generated by qmake (2.01a) Tue Dec 7 17:15:59 2010
Line 39: Line 30:
 </code> </code>
  
 +In contrast, here is a virgin ''*.pro'' file in a virgin (empty) directory:<code bash>
 +######################################################################
 +# Automatically generated by qmake (2.01a) Tue Dec 7 17:07:32 2010
 +######################################################################
 +
 +TEMPLATE = subdirs
 +
 +# Directories
 +</code>
 ===== Enabling debug/release builds ===== ===== Enabling debug/release builds =====
 In Unix (including Linux and OS X) you can explicitly specify debug and release build options: In Unix (including Linux and OS X) you can explicitly specify debug and release build options:
Line 51: Line 51:
 I have not yet tested Windows, but the above config option is supposedly not needed and/or invalid in Windows. I have not yet tested Windows, but the above config option is supposedly not needed and/or invalid in Windows.
  
-===== Adding files =====+===== Adding source code files =====
 To add the files ''{YourClass}.h'' and ''{YourClass}.cpp'' to your project, replace To add the files ''{YourClass}.h'' and ''{YourClass}.cpp'' to your project, replace
 <code>SOURCES += main.cpp</code> with <code>SOURCES += main.cpp</code> with
Line 59: Line 59:
 HEADERS = {YourClass}.h           HEADERS = {YourClass}.h          
 </code> </code>
 +
 +===== Adding resource collection files =====
 +For a resource to be compiled into the binary the *.qrc file must be mentioned in the .pro file:
 +<code>RESOURCES = foo.qrc</code>
  
 ===== Additional Qt libraries ===== ===== Additional Qt libraries =====
Line 67: Line 71:
 where ''{libnameX}'' is one of: ''network'', ''opengl'', ''sql'', ''xml'', ''support''. (Note: this list may not be complete as new libraries may have been added since this was written.) where ''{libnameX}'' is one of: ''network'', ''opengl'', ''sql'', ''xml'', ''support''. (Note: this list may not be complete as new libraries may have been added since this was written.)
  
-The above libraries correspond toQtNetwork, QtOpenGL, QtSQL, QtXML, and QtAssistantClient+Qt3Support.+The above names correspond to the QtNetwork, QtOpenGL, QtSQL, QtXML, and QtAssistantClient+Qt3Support libraries. 
 + 
 +===== Official documentation ===== 
 +[[http://doc.qt.nokia.com/qmake-project-files.html]]
qt/pro_files.1291750798.txt.gz · Last modified: 2010/12/07 19:39 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki