carbidecpp22devenv/configuration/org.eclipse.osgi/bundles/309/1/.cp/concepts/cdt_c_projects.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
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     4
<head>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     5
	<meta http-equiv="Content-Language" content="en-us">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     6
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     7
	<title>CDT projects</title>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     8
	<link rel="stylesheet" type="text/css" href="../help.css">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
     9
</head>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    10
<body>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    11
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    12
<h1>CDT projects</h1>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    13
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    14
<p>Before you can work in the CDT, you must create a project to store your 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    15
source code, makefiles, binaries, and related files. C/C++ projects are displayed 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    16
in the C/C++ Projects view.</p>
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><b>Tip:</b> Nested projects are not supported. Each project must be organized as a 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    19
discrete entity. Project dependencies are supported by allowing a project 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    20
to reference other projects that reside in your workspace. For more information, 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    21
see <a href="../reference/cdt_u_prop_general_pns_ref.htm">Selecting referenced projects</a>.</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>For more information about projects and where they are stored, see:</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
<ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    26
  <li> <b>Workbench User Guide &gt; Tasks &gt; Resources</b></li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    27
  <li> <b>Workbench User Guide &gt; Tasks &gt; Running Eclipse</b></li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    28
</ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    29
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    30
<h2>Project types</h2>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    31
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    32
<p>You can create a C or C++ project.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    33
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    34
<p>To build your project, you can either create your own makefile,
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    35
or let CDT generate the makefiles for you automatically.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    36
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    37
<p>You can toggle these modes (generate makefiles or not) 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    38
at any time for existing project. Use <a href="../reference/cdt_o_proj_prop_pages.htm">properties.</a> </p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    39
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    40
<p>When you create a new project, you are required to specify the project type. This project type will determine the toolchain and data, and tabs that the CDT uses. 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
    41
	<ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    42
	<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
    43
	<ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    44
	<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
    45
	<li><b>Hello World ANSI C Example</b> provides a simple C Hello World application with main().<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
    46
</ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    47
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    48
<p>After you select a template, the result is a project with only the meta-data files required for the project type. You are expected to modify these source files, as required, and provide source files for the project's target.</p><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
    49
		<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
    50
libxx.so.<var>version</var>, where
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    51
<var>version</var> is a number with a default of 1. The
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    52
libxx.so file usually is a symbolic link to the
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    53
latest version.</p><p>The makefile for this project type is automatically created by the CDT.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    54
		<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
    55
into an archive (*.a) that is directly linked into an
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    56
executable.</p><p>The makefile for this project type is automatically created by the CDT.
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    57
		<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
    58
	</ul> 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    59
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    60
<h2>Project conversion</h2>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    61
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    62
<p>You can convert projects from C to C++ (or from C++ to C).  If, for 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    63
example, your requirements change and you must convert an existing C project to C++, 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    64
you can do this without recreating the project.  The CDT converts your project files and 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    65
resolves any source control issues.</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
<h2>A few notes about projects</h2>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    68
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    69
<ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    70
  <li>When you create a file within a project, a record (local history) of 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    71
  every change is created. For more information about local history, see 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    72
  <b>Workbench User Guide &gt; Reference &gt; User interface 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    73
  information &gt; Development environment &gt; Local history</b>.</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    74
  <li>Spaces in projects and filenames can cause problems with some 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    75
tools, such as the make utility or the compiler.</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    76
  <li>Be careful when you use only case to distinguish files and projects. UNIX-based 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    77
  operating system file names are case sensitive, but Windows filenames are not. Therefore, Hello.c and 
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    78
hello.c are separate files in UNIX but overwrite each other in Windows.</li>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    79
</ul>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    80
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    81
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    82
<p>For more information about projects, see <b>Workbench User Guide &gt; Concepts &gt; Workbench &gt; Resources</b>.</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    83
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    84
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    85
<p><img border="0" src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    86
<br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    87
<a href="cdt_c_proj_file_views.htm">Project file views</a><br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    88
<a href="../getting_started/cdt_w_existing_code.htm">How to bring C/C++ source into Eclipse</a></p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    89
<p><img border="0" src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    90
<br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    91
<a href="../tasks/cdt_o_proj_files.htm">Working with C/C++ project files</a><br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    92
<a href="../tasks/cdt_t_conv_proj.htm">Converting a C or C++ nature for a project</a>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    93
</p>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    94
<p><img border="0" src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    95
<br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    96
<a href="../reference/cdt_o_proj_prop_pages.htm">Project properties</a><br>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
    97
<a href="../reference/cdt_o_views.htm">Views</a></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
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   100
<img src="../images/ng00_04a.gif" ALT="IBM Copyright Statement" >
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   101
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   102
</body>
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   103
684bf18fdedf add files for RCL_2_2
cawthron
parents:
diff changeset
   104
</html>