carbidecpp22devenv/configuration/org.eclipse.osgi/bundles/309/1/.cp/getting_started/cdt_w_basic.htm
changeset 5 684bf18fdedf
equal deleted inserted replaced
4:4764c8c88759 5:684bf18fdedf
       
     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
       
     2 <html lang="en">
       
     3 <head>
       
     4 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
       
     5 	<title>New CDT Project with generated makefile - Tutorial</title>
       
     6 	<link rel="stylesheet" type="text/css" href="../help.css">
       
     7 <script language="JavaScript">
       
     8 function newWin(url) {
       
     9 	window.open(url, 'install_cdt', 'width=900, height=700, menubar=no, toolbar=no, status=no, resizable=yes, location=no, scrollbars=yes');
       
    10 }
       
    11 </script>
       
    12 </head>
       
    13 <body>
       
    14 <h2>Tutorial: Creating a simple application</h2>
       
    15 
       
    16 <p>In this tutorial, you will use the CDT to create a simple 'Hello World' application.
       
    17 This tutorial describes the process of creating a new C++ project where the build is
       
    18 automatically managed by the CDT, and running the program.</p>
       
    19 
       
    20 <p>Note: In earlier versions of the CDT, there were two separate project types:
       
    21 Managed make (automatically generated a makefile)
       
    22 and Standard make (required the user's makefile to build).
       
    23 Now with CDT, you now select a project type, and that determines what build system will be used.</p>
       
    24 
       
    25 <p>To create a simple "Hello World" application using the CDT, you will perform the following steps:</p>
       
    26 
       
    27 <h3> Step 1: Creating a project</h3>
       
    28 <ol>
       
    29 	<li>Select <b>File &gt; New &gt; Project</b>.</p>
       
    30 	<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic02.png')">Click here to see an illustration (displayed in a separate window)</a>.</p><br></li>
       
    31 
       
    32 	<li>Select the type of project to create. For this tutorial, expand the <b>C++</b> folder and select <b>C++ Project</b> and click <b>Next</b>.
       
    33 	<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic03a.png')">Click here to see an illustration.</a><br></p>
       
    34 	<p><br>The <b>C++ Project</b> wizard opens.</p>
       
    35 	<a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic04.png')">Click here to see an illustration.</a><br></p>
       
    36     <p><br>By default, the CDT filters the <b>Toolchain</b> and <b>Project types</b> that it displays in those lists based on the language support for the C++ Project wizard you selected for this tutorial.</p>
       
    37     </li><br>
       
    38     <li><p>In the <b>Project name</b> field, type a name for the project, such as <b>Hello World</b>.</p>
       
    39     <br>
       
    40     <li><p>From the <b>Project types</b> list, expand <b>Executable</b> and select <b>Hello World C++ Project</b>. This project type provides a simple Hello World application in C++, and the makefile is automatically created by the CDT.</p>
       
    41 	<br>
       
    42     <li><p>Select a required toolchain from the <b>Toolchain</b> list.</p>
       
    43     <br>
       
    44     <p>A toolchain is a set of tools (such as a compiler, linker, and assembler) intended to build your project.
       
    45     Additional tools, such as a debugger, can be associated with a toolchain.
       
    46     There can be several toolchains available, depending on the compilers installed on your system.</p>
       
    47     <br>
       
    48     <li><p>Click <b>Next</b>.</p>
       
    49     <br>
       
    50     <p>The Select Configurations window displays a list of configurations based on the project type and toolchain(s) you selected earlier.
       
    51     <br>
       
    52     <a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic07.png')">Click here to see an illustration.</a></p>
       
    53     <br>
       
    54     <li><p>Optional: If you want to change the default project settings, click <b>Advanced Settings</b>.</p>
       
    55     <br>
       
    56     <p>This opens the project properties dialog for your new project allowing you change any of the project specific settings,
       
    57     such as includes paths, compiler options, and libraries.</p>
       
    58     <p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic21.png')">Click here to see an illustration.</a></p>
       
    59     <br>
       
    60 	<li>If you clicked <b>Next</b> at Step 6, you can specify the basic properties for the new project, such as your name, copyright, and source information.</p>
       
    61 	<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic22.png')">Click here to see an illustration.</a></p>
       
    62 	<br>
       
    63     <li><p>Click <b>Finish</b>.</p>
       
    64     <br>
       
    65 	<li><p>If the <b>C++ perspective</b> is not currently set as the default, you are prompted to determined if you would like to this project to be associated with the C/C++ perspective. Click <b>Yes</b>.
       
    66 	<br><p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_cpp_perspectx.png')">Click here to see an illustration.</a></p>
       
    67 	<br>
       
    68 	<p>A project is created with the default settings and a full set of configurations based on the project type and toolchain you selected.
       
    69 	You should now see the new project in C/C++ Projects view.</p>
       
    70 	<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic12.png')">Click here to see an illustration.</a></p>
       
    71 	<br>
       
    72 </ol>
       
    73 
       
    74 <h3>Step 2: Reviewing the code and building the project</h3>
       
    75 <ol>
       
    76 	<li>From the Project Explorer in the C++ Projects View, double-click the .cpp file that was created for your project, for example, <tt>Hello World.cpp</tt>. 
       
    77 	<p>Note that the file may be within a folder inside the project, e.g. the "src" folder.</p>
       
    78 	<p>This file opens in a default editor. It contains C++ template code for the Hello World example project you selected earlier.</p>
       
    79 	<br>
       
    80 	<p><b>Note:</b> You can specify a different editor, and add or modify existing code templates in <b>Window &gt; Preferences</b>.</p><p>In addition, the <b>Outline</b> view has also been populated
       
    81 with objects created from your code.</p> <p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic13.png')">Click here to see an illustration.</a></p>
       
    82 </li>
       
    83 <li>Optional: You can type additional code in this file, and then save the changes by clicking <span
       
    84  style="font-weight: bold;">File &gt; Save</span>, or pressing <b>CTRL+S</b>.
       
    85  
       
    86  <p><br>Next, you will need to build your project before you can run it.</p><br></li>
       
    87 <li>Build your project by pressing <b>CTRL+B</b>, or select the project from the Project Explorer tab in the C++ Projects view and select <b>File &gt; Build Project</b>.</p>
       
    88 <p><br><b>Note:</b> If a build generates any errors or warnings, you can see those in the Problems view. If you encounter difficulty, see the topics <a href="../concepts/cdt_c_build_over.htm">Building C/C++ projects</a> and <a href="../concepts/cdt_c_before_you_begin.htm">Before you begin</a><br>.</p></li>
       
    89 <li>Read through the build messages in the <b>Console</b> view.
       
    90 The project should build successfully.</p>
       
    91 <br>
       
    92 <p>You will also see the <b>Outline</b> view has also been populated
       
    93 with objects created from your code. If you select an item from the <b>Outline</b> view, the
       
    94 corresponding text in the editor is highlighted.</p><br>
       
    95 </ol>  
       
    96 
       
    97 <h3>Step 3: Running the application</h3>
       
    98 
       
    99 <p>To run your application:</p>
       
   100 <ol>
       
   101 	<li>Within the C/C++ Perspective, click <b>Run &gt; Run Configurations...</b>.<p><br></p></li>
       
   102 	<li>Select <b>C/C++ Application</b>.<p><br></p></li>
       
   103     <li>Click <b>New</b>.<p><br></p></li>
       
   104 
       
   105 	<p>A new Run Configuration is created. Its name and path to the executable are provided by the project ('Hello World' in our case). 
       
   106 
       
   107 	<li>Click <b>Run</b>.<p><br></p>
       
   108 
       
   109 <p>Now, you should see the Hello World application running in the <b>Console</b> view.  
       
   110 The <b>Console</b> also shows which application is running in a title bar.</p><br></li>
       
   111 
       
   112 	<li>You can click the other views to see the information that they contain.
       
   113 </ol> 
       
   114 
       
   115 
       
   116 <hr>
       
   117 <img src="../images/ng00_07.gif" ALT="QNX Software Systems Copyright Statement" >
       
   118 </body>
       
   119 </html>