Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

Setting Up a Generic Project

Qt Creator supports generic projects, so you can import existing projects that do not use qmake or CMake and Qt Creator ignores your build system.

Generic project support allows you to use Qt Creator as a code editor. You can change the way your project is built by modifying the make command in the Projects mode under Build Settings.

When you import a project, Qt Creator creates the following files that allow you to specify which files belong to your project and which include directories or defines you want to pass to your compile: .files, .includes, and .config.

Importing a Generic Project

To import an existing generic project:

  1. Select File > New File or Project... > Other Project > Import Existing Project.
  2. In Import Existing Project, enter the project name and select the location of the project file you want to import.

    Qt Creator automatically generates the following files in the project directory:

When the project is successfully imported, Qt Creator creates the project tree in the sidebar.

After importing a generic project into Qt Creator, open it by selecting the .creator file.

Working with Generic Project Files

For a generic project, you have to manually specify which files belong to your project and which include directories or defines you want to pass to your compiler.

Specifying Files

The list of files for a generic project is specified in the .files file. When you first create a generic project, Qt Creator adds any files it recognizes to your project.

To add or remove files, edit the .files file in Qt Creator. Qt Creator recreates your project tree when you save the .files file. Alternatively, you can add and remove files using the context menu in the project tree.

If you frequently need to update the .files file, you can do so efficiently by using a script that updates the file for you. If the file is modified externally, you have to restart Qt Creator for the changes to take effect.

To update the .files on the Git repository use the following script:

 git ls-files "*.cpp" "*.h" > MyProject.files

Specifying Include Paths

The include paths are specified in the .includes file, one include path per line. The paths can be either absolute or relative to the .includes file.

Specifying Defines

The defines are specified in the .config file. The .config file is a regular C++ file, prepended to all your source files when they are parsed. Only use the .config file to add lines as in the example below:

 #define NAME value

Creating a Run Configuration

Qt Creator cannot automatically determine which executable to run.

In the Projects mode under Run Settings, define the executable file to run:

  1. Click Add and select Custom Executable.
  2. Define the configuration name, the location of the executable, any additional arguments and the working directory.
X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtcreator-2.3
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web