carbidecpp22devenv/configuration/org.eclipse.osgi/bundles/309/1/.cp/getting_started/cdt_w_newproj.htm
author cawthron
Fri, 04 Dec 2009 10:01:33 -0600
changeset 5 684bf18fdedf
permissions -rw-r--r--
add files for RCL_2_2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     2
<html lang="en">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     3
<head>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     4
	<meta http-equiv="content-language" content="en-us">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     5
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     6
	<title>Creating your project</title>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     7
	<link href="../help.css" type="text/css" rel="stylesheet">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     8
<script language="JavaScript">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     9
function newWin(url) {
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    10
	window.open(url, 'install_cdt', 'width=750, height=700, menubar=no, toolbar=no, status=no, resizable=yes, location=no, scrollbars=yes');
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    11
}
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    12
</script>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    13
</head>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    14
<body> 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    15
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    16
<h1>Creating a Makefile project</h1>  
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    17
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    18
<p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    19
This tutorial describes the process of creating a new C++ project that includes a makefile, and debugging the program.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    20
<p>You need to create a project to contain your source code and related files. A  project has an associated builder
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    21
that can incrementally compile source files as  they are changed.</p> 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    22
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    23
<p>To create a project:</p> 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    24
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    25
<ol>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    26
	<li>Select <b>File &gt; New &gt; Project</b>.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    27
<p><br>When you create a new project, you are required to specify the project type. This project type will determine the toolchain, data, and tabs that the CDT uses/displays.</p><br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    28
<li>Select the type of project to create. For this tutorial, expand the <b>C/C++</b> folder and select <b>C++ Project</b>.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    29
	<br><p>The <b>C++ Project</b> wizard opens. <a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic19.png')">Click here to see an illustration.</a></p><br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    30
<p>By default, the CDT filters the <b>Toolchain</b> and <b>Project types</b> that currently display in those lists are based on the language support for the C++ Project wizard you selected for this tutorial.</p><br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    31
<li>In the <b>Project name</b> field, type HelloWorld.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    32
<li>Leave the <b>Use Default Location</b> option selected.  
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    33
	<p><br>Next, you want to select the type of project to create. In the New CDT Project Wizard, you can choose from the following project types:</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    34
	<ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    35
	<li><b>Executable</b> - Provides an executable application. This project type folder contains three templates.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    36
	<ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    37
	<li><b>Hello World C++ Example</b> provides a simple C++ Hello World application with main().
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    38
	<li><b>Hello World ANSI C Example</b> provides a simple C Hello World application with main().
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    39
	<li><b>Empty Project</b> provides a single source project folder that contains no files.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    40
	<p>After you select this template, the result is a project with only the meta-data files required for the project type. 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    41
	You are expected to  provide source files for the project's target.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    42
	</ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    43
	<p>The makefile for the <b>Executable</b> project type is automatically created by the CDT.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    44
<p>&nbsp;</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    45
		<li><b>Shared Library</b> - An executable module that is compiled and linked separately. When you create a project that uses a shared library (libxx.so), you define your shared library's project as a Project Reference for your application. For this project type, the CDT combines object files together and joins them so they're relocatable and can be shared by many processes. Shared libraries are named using the format
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    46
 libxx.so.<var>version</var>, where
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    47
<var>version</var> is a number with a default of 1. The
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    48
libxx.so file usually is a symbolic link to the
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    49
latest version. The makefile for this project type is automatically created by the CDT.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    50
		<li><b>Static Library</b> - A collection of object files that you can link into another application (libxx.a). The CDT combines object files (i.e. *.o)
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    51
into an archive (*.a) that is directly linked into an
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    52
executable. The makefile for this project type is automatically created by the CDT.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    53
		<li><b>Makefile Project</b> - Creates an empty project without the meta-data files. This selection is useful for importing and modifying existing makefile-based projects; a new makefile is not created for this project type. 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    54
	</ul> 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    55
	
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    56
<p>By default, the CDT filters the <b>Toolchain</b> and <b>Project types</b> that currently display in those lists  based on the language support for the C++ Project wizard you selected for this tutorial.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    57
<p>&nbsp;</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    58
<li>From the <b>Project types</b> list, expand <b>Makefile project</b> and select <b>Empty Project</b>. 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    59
This project lets you enter the source file and the makefile yourself.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    60
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    61
<li>Select a required toolchain from the <b>Toolchain</b> list. 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    62
<p>A toolchain is a set of tools (such as a compiler, linker, and assembler) intended to build your project.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    63
Additional tools, such as a debugger, can be associated with a toolchain.<br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    64
There can be several toolchains available, depending on the compilers installed on your system.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    65
</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    66
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    67
</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    68
<li>Click <b>Next</b>.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    69
<li>(Optional) On the <b>Select Configurations</b> page, Click <b>Advanced Settings</b>.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    70
<ul> 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    71
<li>Expand <b>C/C++Build > Settings</b>. Click the <b>Binary Parsers</b> tab.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    72
<p><br><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_binparser01.png')">Click here to see an illustration.</a></p><br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    73
</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    74
</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    75
<li>In the <b>Binary Parser</b> list, select the error parser that is appropriate for your platform.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    76
Other project settings can be modified here as well.  The default selection is probably OK.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    77
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    78
</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    79
<p>To ensure the accuracy of the C/C++  Projects view and the ability to successfully
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    80
run and debug your programs, selecting the correct parser is important. After
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    81
you select the correct parser for your development environment and build your
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    82
 project, you can view the components of the .o file in the C/C++ Projects
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    83
view. You can also view the contents of the .o file in the C/C++ editor.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    84
<p></p>Click <b>OK</b> to close the Project Properties window.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    85
</ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    86
</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    87
<li>Click <b>Finish</b>.</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    88
<li>If a message box prompts you to change perspectives, click <b>Yes</b>.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    89
</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    90
</ol>  
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    91
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    92
<p>Your new project displays in the Project Explorer view. 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    93
Your project is empty because you have not yet created
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    94
files for your project. 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    95
You may see an error since there is nothing to build yet for your project.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    96
You can now start writing the code for your HelloWorld
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    97
program.</p>  
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    98
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    99
<p><b>Tip:</b> You can view and modify the properties of your
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   100
HelloWorld project at any time by right-clicking on the project in the <b>Project Explorer</b> 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   101
view and clicking Properties.</p>  <p><a style="text-decoration: none" href="cdt_w_newcpp.htm"><img
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   102
src="../images/ngnext.gif" height="16" width="16" border="0" alt="Next Icon"></a> <a href="cdt_w_newcpp.htm"><b>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   103
Next: Creating your C++ file</b></a></p>  <p align="left">For more information
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   104
about:</p>  <ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   105
<li>Projects, see <b>Workbench User Guide > Concepts > Workbench  > Resources
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   106
</b></li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   107
<li>The workspace, see <b>Workbench User Guide  > Tasks > Upgrading Eclipse
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   108
</b></li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   109
</ul>  <p><img src="../images/ngconcepts.gif" alt="Related concepts" height="21" width="143"
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   110
border="0"> <br> <a href="../concepts/cdt_c_over_cdt.htm">CDT overview</a><br> <a href="../concepts/cdt_c_projects.htm">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   111
CDT projects</a><br> <a href="../concepts/cdt_c_proj_file_views.htm">Project file views
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   112
</a></p> <p><img src="../images/ngtasks.gif" alt="Related tasks" height="21" width="143"
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   113
border="0"> <br> <a href="../tasks/cdt_o_proj_files.htm">Working with C/C++ project files</a></p> <p><img
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   114
src="../images/ngref.gif" alt="Related reference" height="21" width="143" border="0"> <br> <a
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   115
href="../reference/cdt_o_proj_prop_pages.htm">C/C++ Projects view</a></p>  
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   116
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   117
<p><img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" ></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   118
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   119
</body>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   120
</html>