1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Generate more of the documentation with asciidoc and automate more

- Migrate all getting_started from html to adoc
- Document (in README.md) notes on migrating html to adoc
- Reorganize generation of adoc slightly so that
  - all directories can be generates at once
  - output suffix changed to htm so that migrated files
    exist at the same URL on help.eclipse.org
- Add generation to the cleanliness checks to ensure that the
  html matches adoc
- Manage the adoc headers with a script as that is a large section
  of copy-pasted code on each adoc file (see README + adoc-headers.txt)
- Move maven version info to pluginManagement (consistency with other
  maven plug-ins)
- New profile "asciidoc-auto-refresh" which will auto build the
  files as edited.

Prerequisite of #992
This commit is contained in:
Jonah Graham 2025-01-07 20:18:01 -05:00
parent f019b916a6
commit 9aa3144840
42 changed files with 1731 additions and 1378 deletions

View file

@ -21,6 +21,8 @@ jobs:
- 'dsf/**'
- 'debug/**'
- 'jtag/**'
docs:
- 'doc/org.eclipse.cdt.doc.user/**'
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
@ -64,3 +66,17 @@ jobs:
path: |
*/*/target/surefire-reports/*.xml
terminal/plugins/org.eclipse.tm.terminal.test/target/surefire-reports/*.xml
- name: Prepare Docs for upload
if: (success() || failure()) && steps.filter.outputs.docs
run: |
mkdir -p docs/user
cd docs/user
unzip ../../releng/org.eclipse.cdt.repo/target/repository/plugins/org.eclipse.cdt.doc.user_*.jar
- name: Upload Docs
uses: actions/upload-artifact@v4
if: (success() || failure()) && steps.filter.outputs.docs
with:
name: docs
include-hidden-files: true
path: |
docs/**

View file

@ -1,2 +1,2 @@
/html/
/workspace/
/getting_started/
/example/

View file

@ -10,4 +10,50 @@ During content development, HTML files may be generated by invoking Maven locall
```
mvn --define jgit.dirtyWorkingTree-cdtDefault=ignore --projects org.eclipse.cdt:org.eclipse.cdt.doc.user generate-resources
# or to turn on auto-refresh
mvn --define jgit.dirtyWorkingTree-cdtDefault=ignore --projects org.eclipse.cdt:org.eclipse.cdt.doc.user generate-resources -P asciidoc-auto-refresh
```
Adding `-DuseSimrelRepo`, and after first run `-o` can speed up target platform resolution speed significantly.
## Embedding commands in help
Embedding commands in help needs to modify syntax slightly.
Links in adoc are always surrounded by double-quotes, therefore single-quotes (`'`) or escaped double-quote (`"`) need to be used in the command, as appropriate, this is opposite to the quoting that is shown in the Eclipse help [documentation](https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/guide/ua_help_content_command_authoring.htm).
See the [Eclipse help for general information](https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/guide/ua_help_content_command.htm).
e.g. opening a preference page can be done like this:
`
image:command_link.png[] link:javascript:executeCommand('org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Editors)')[General > Editors]
`
Notes:
- The `livehelp.js` is included automatically with `docinfo-header.htm`
- `PLUGINS_ROOT` cannot be used within the adoc files, so use `image:command_link.png[]` instead
## Converting html CDT help to adoc
Use pandoc, e.g.:
```
pandoc getting_started/cdt_w_basic.htm -o src/getting_started/cdt_w_basic.adoc
# or a whole group of files
for i in getting_started/*; do pandoc -o src/${i%.*}.adoc $i; done
```
Apply these changes after:
- Replace `image:../images/` -> `image:` because we use images in different locations depending on whether we are in GitHub or in online help
- Replace `link:([^[]+).htm\[` -> `xref:$1.adoc[` so that links are always to `adoc` files. Asciidoctor will change that to `htm` on generation so if target has not been converted yet that is ok. This allows links to work when asciidoctor generates for other formats
- Fix anchors `\[#([^\]]+)\]####` -> `[[$1]]`
- Fix unneeded ` ` with `\u00A0` -> nothing (some of these were used to indent makefiles, but that meant they couldn't be copied and pasted anyway, so another solution is needed)
- Remove doubled-up line continuation characters `^\+\n \+` -> `+`
- Remove extra `+` around horizontal rulers (lines with `'''''`) `'''[\n\s]+\+` -> `'''` and ` *\+[\n\s]+'''` -> `'''`
- Removed unneeded line breaks `(.) \+$` -> `$1` (lines that have just `+` are [list continuation](https://docs.asciidoctor.org/asciidoc/latest/lists/continuation/#list-continuation))
- Since `C++` uses a double `+` it can confuse asciidoc, replace `C\+\+` -> `{cpp}` (the C++ attribute). See [Character Replacement Attributes Reference](https://docs.asciidoctor.org/asciidoc/latest/attributes/character-replacement-ref/) for all built-in attributes.
- Remove copyright statements from bottom of files (the `docinfo-footer.htm` has copyright)
- Fix the related concepts/tasks in the footer (convert to lists?)
- Add the headers to the adoc file to enable all the features and ensure consistent copyrights. See adoc-headers.txt
- Remove the original htm file from source control and add it to .gitignore (add whole folder if possible, or individual files if not whole folder is converted)

View file

@ -0,0 +1,29 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER

View file

@ -23,6 +23,8 @@ bin.includes = about.html,\
contexts_CDT_make.xml,\
getting_started/,\
help.css,\
helpadoc.css,\
font-awesome/,\
images/,\
plugin.properties,\
plugin.xml,\
@ -38,8 +40,7 @@ bin.includes = about.html,\
intro/,\
notices.html,\
book.css,\
index*/,\
html/
index*/
bin.excludes = build.properties,\
customBuildCallbacks.xml

View file

@ -1,50 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tutorials</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>
<body>
<div role="main">
<h1>Getting Started</h1>
<p>The following tutorials guide you through the process of using the C/C++ Development Toolkit (CDT) to:</p>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_prepare_workbench.htm">Prepare the Workbench</a><br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_basic.htm">Create a simple application</a><br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_newproj.htm">Create a Makefile project</a><br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_import.htm">Import an existing project </a><br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_newcpp.htm">Create a C++ file </a><br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_newmake.htm">Create a makefile </a><br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_build.htm">Build a project</a><br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_debug.htm">Debug a project</a><br>
<br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_existing_code.htm">Import C/C++ source into Eclipse</a><br>
<img src="../images/trans.gif" width="25" height="1" alt=""><a style="text-decoration:none" href="cdt_w_install_cdt.htm">Install/update the CDT</a><br>
<p>An alternative getting started is available on the Wiki at <a href="https://wiki.eclipse.org/CDT/Setting_Up_Eclipse_CDT" target="_blank">Setting Up Eclipse CDT</a>.</p>
<p> <img src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
<br>
<a href="../concepts/cdt_o_home.htm">CDT Home</a><br>
</p>
<p><img src="../images/ng00_04a.gif" ALT="QNX Software Systems Copyright Statement" ></p>
</div>
</body>
</html>

View file

@ -1,166 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>New CDT Project with generated makefile - Tutorial</title>
<link rel="stylesheet" type="text/css" href="../book.css">
<!--
<script language="JavaScript">
function newWin(url) {
window.open(url, 'install_cdt', 'width=900, height=700, menubar=no, toolbar=no, status=no, resizable=yes, location=no, scrollbars=yes');
}
</script>
-->
</head>
<body>
<div role="main"><h1>Tutorial: Creating a simple application</h1>
<p>In this tutorial, you will use the CDT to create a simple 'Hello World' application.
This tutorial describes the process of creating a new C++ project where the build is
automatically managed by the CDT, and running the program.</p>
<p><strong>NOTE</strong>: In earlier versions of the CDT, there were two separate project types:
Managed make (automatically generated a makefile)
and Standard make (required the user's makefile to build).
Now with CDT, you just select a project type, and that determines what build system to use.</p>
<p>To create a simple "Hello World" application using CDT, perform the following general steps:</p>
<ol>
<li><a href="#cdt_create">Creating a project</a></li>
<li><a href="#cdt_build">Reviewing the code and building the project</a></li>
<li><a href="#cdt_running">Running the application</a></li>
</ol>
<hr>
<h2> Step 1: <a name="cdt_create"></a>Creating a project</h2>
<ol>
<li>Select <strong>File &gt; New &gt; Project</strong>.<br>
<br>
<img src="../images/cdt_w_basic02.png" alt="Select File &gt; New &gt; Project menu option" width="591" height="183">
<p><br>
</p>
</li>
<li>Select the type of project to create. For this tutorial, expand the <strong>C++</strong> folder and select <strong>C++ Project</strong> and click <strong>Next</strong>.<br>
<br>
<img src="../images/cdt_w_basic03a.png" alt="Select project type" width="525" height="500"><br>
<br>
</li>
<li>
<p>The <strong>C++ Project</strong> wizard opens.<br>
</p>
<p><img src="../images/cdt_w_basic04.png" alt="C++ project wizard" width="525" height="576"><br>
<br>By default, the CDT filters the <strong>Toolchain</strong> and <strong>Project types</strong> that it displays in those lists based on the language support for the C++ Project wizard you selected for this tutorial.</p>
<br>
<ol style="list-style-type: lower-alpha;">
<li>In the <strong>Project name</strong> field, type a name for the project, such as <strong>HelloWorld</strong>.
<p><br>
</p>
</li>
<li>From the <strong>Project type</strong> list, expand <strong>Executable</strong> and select <strong>Hello World C++ Project</strong>. This project type provides a simple Hello World application in C++, and the makefile is automatically created by the CDT.
<p><br>
</p>
</li>
<li>Select a required toolchain from the <strong>Toolchain</strong> list.
<p><br>
</p>
<p>A toolchain is a set of tools (such as a compiler, linker, and assembler) intended to build your project.
Additional tools, such as a debugger, can be associated with a toolchain.
There can be several toolchains available, depending on the compilers installed on your system.</p>
<p><br>
</p>
</li>
<li>Click <strong>Next</strong>. </li>
</ol>
<br>
</li>
<li>Specify the <strong>Basic Properties</strong> for the new project, such as your author, copyright, and source information, then click <strong>Next</strong>.<br>
<br>
<img src="../images/cdt_w_basic06a.png" alt="Basic properties of a project" width="525" height="576"><br>
<br>
</li>
<li>
<p>The <strong>Select Configurations</strong> page displays a list of configurations based on the project type and toolchain(s) selected earlier. <br>
<br>
<img src="../images/cdt_w_basic07.png" alt="Select configurations page" width="525" height="576"><br>
<br>
<strong>OPTIONAL</strong>: If you want to change the default project settings, click <strong>Advanced Setting</strong> to open the <a href="../reference/cdt_u_prop_all.htm">Project Properties</a> dialog for your new project allowing you change any of the project specific settings,
such as includes paths, compiler options, and libraries.<br>
<br>
</p></li>
<li><p>Click <strong>Finish</strong>.<br>
</p></li>
</ol>
<p><strong>NOTE</strong> If the <strong>C++ perspective</strong> is not currently set as the default, you are prompted to determine if you would like to this project to be associated with the C/C++ perspective. Click <strong>Yes</strong>.<br>
</p>
<p>A project is created with the default settings and a full set of configurations based on the project type and toolchain you selected.
You should now see the new project in <a href="../reference/cdt_u_project_explorer_view.htm">Project Explorer</a> view.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="../images/cdt_w_basic12.png" alt="New project displayed in the Project Explorer view" width="423" height="283"></p>
<br>
<hr>
<br>
<h2>Step 2: <a name="cdt_build" id="cdt_build"></a>Reviewing the code and building the project</h2>
<ol>
<li>From the <strong>Project Explorer</strong> view, double-click the .cpp file created for your project, for example, <span class="typewriter">HelloWorld.cpp</span>. You'll find it within the project "<span class="typewriter">src</span>" folder.<br>
<br>
<p>This file opens in a default editor. It contains C++ template code for the Hello World example project you selected earlier. In addition, the <a href="../reference/cdt_u_outline_view.htm">Outline</a> view has also been populated
with objects created from your code.<br>
<br>
<img src="../images/cdt_w_basic13.png" alt="C Editor with Outline view" width="731" height="333"><br>
<br>
<strong>NOTE:</strong> You can specify a different editor, and add or modify existing code templates in <strong>Window &gt; Preferences</strong>.<br>
<br>
<strong>OPTIONAL</strong>: You can type additional code in this file, and then save the changes by clicking <span
style="font-weight: bold;">File &gt; Save</span>, or pressing <strong>CTRL+S</strong>.<br>
<br>
Next, you will need to build your project before you can run it.<br>
<br>
</p>
</li>
<li>Build your project by pressing <strong>CTRL+B</strong>, or select the project in the <strong>Project Explorer</strong> view and select <strong>Project &gt; Build Project</strong>.
</p>
<p><br>
<strong>NOTE:</strong> If a build generates any errors or warnings, you can see those in the <a href="../reference/cdt_u_problems_view.htm">Problems</a> 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>
<li>Read through the build messages in the <a href="../reference/cdt_u_console_view.htm">Console</a> view.
The project should build successfully.</p>
<br>
<br>
<p>You will also see the <strong>Outline</strong> view has also been populated
with objects created from your code. If you select an item from the <strong>Outline</strong> view, the
corresponding text in the editor is highlighted.</p></li>
</ol>
<hr>
<br>
<h2>Step 3: <a name="cdt_running" id="cdt_running"></a>Running the application</h2>
<p>To run your application:</p>
<ol>
<li>Within the C/C++ Perspective, click <strong>Run &gt; Run Configurations...</strong>.<p><br></p></li>
<li>Select <strong>C/C++ Application</strong>.<p><br></p></li>
<li>Click <strong>New</strong>.<br>
<p>A new Run Configuration is created. Its name and path to the executable are provided by the project ('Hello World' in our case).
</li>
<li>Click <strong>Run</strong>.<p><br></p>
<p>Now, you should see the Hello World application running in the <strong>Console</strong> view.
The <strong>Console</strong> also shows which application is running in a title bar.</p><br></li>
<li>You can click the other views to see the information that they contain.</li>
</ol>
<hr>
<img src="../images/ng00_07.gif" ALT="QNX Software Systems Copyright Statement" >
</div></body>
</html>

View file

@ -1,65 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Building your project</title>
<link rel="stylesheet" type="text/css" href="../help.css">
<!--
<script language="JavaScript">
function newWin(url) {
window.open(url, 'install_cdt', 'width=750, height=700, menubar=no, toolbar=no, status=no, resizable=yes, location=no, scrollbars=yes');
}
</script>
-->
</head>
<body>
<div role="main"><h1>Building a project</h1>
<p>The make output and build progress information displays in the
<a href="../reference/cdt_u_console_view.htm">Console</a> view. The <a href="../reference/cdt_u_make_targets_view.htm">Make Targets</a> view displays makefile actions, and the
<a href="../reference/cdt_u_problems_view.htm">Problems</a> view displays compile warnings or errors.</p>
<h2>To build a project:</h2>
<ol>
<li>In the <strong>Project Explorer</strong> view, select your project. For the tutorial, you can select the <strong>HelloWorld</strong> project you created earlier. <p><br></p></li>
<li>Click <strong>Project &gt; Build Project</strong>, or click the build icon <img src="../images/hammer-icon.png" alt="build icon"> on the toolbar.
<br><br><p>If you see an error message, such as:</p><br>
<p><samp>&nbsp;&nbsp;&nbsp;(Cannot run program "make": Launching failed)</samp></p><br>
<p>then CDT cannot locate the build command, usually <samp class="typewriter">make</samp>.
Either your path is not configured correctly, or you do not have <samp class="typewriter">make</samp>
installed on your system.</p><br><br></li>
<li>You can see in the <strong>Console</strong> view the output and results of the build command.
Click on its tab to bring the view forward if it is not currently visible.
If for some reason it's not present, you can open it by selecting <strong>Window > Show View > Console</strong>.
<br>
<br>
<img src="../images/cdt_w_newmake03.png" alt="Console view in C/C++ Perspective" width="842" height="633"><br>
</li>
</ol>
<p><img src="../images/ngconcepts.gif" alt="Related concepts"
width="143" height="21">
<br>
<a href="../concepts/cdt_c_projects.htm">CDT Projects</a><br>
<a href="../concepts/cdt_c_build_over.htm">Build overview</a><br>
</p>
<p><img src="../images/ngtasks.gif" alt="Related tasks"
width="143" height="21">
<br>
<a href="../tasks/cdt_o_build_task.htm">Building projects</a><br>
</p>
<p><img src="../images/ngref.gif" alt="Related reference"
width="143" height="21">
<br>
<a href="../reference/cdt_u_newproj_buildset.htm">Make Builder page,
C/C++ Properties window</a><br>
</p>
<p> <a href="cdt_w_debug.htm">
<img src="../images/ngnext.gif" width="16" height="16" alt="Next icon"></a> <strong><a
href="cdt_w_debug.htm">Next: Debugging a project</a></strong></p>
<p> <a href="cdt_w_newmake.htm">
<img src="../images/ngback.gif" width="16" height="16" alt="Previous icon"></a> <strong><a
href="cdt_w_newmake.htm">Back: Creating a makefile</a></strong></p>
<p>
<img src="../images/ng00_04a.gif" alt="QNX Copyright Statement"></p>
</div></body>
</html>

View file

@ -1,132 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Debugging your project</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>
<body>
<div role="main"><h1>Debugging a project</h1>
<p>The debugger lets you control the execution of your program by setting
breakpoints, suspending executed programs, stepping through your code, and
examining the contents of variables.</p>
<h2>To debug a project:</h2>
<ol>
<li>Click the <strong>Run &gt; Debug Configurations...</strong> menu option.<br>
<br>
<p>The <strong>Debug</strong> <strong>Configurations</strong> dialog opens.<br>
<br>
<img src="../images/cdt_w_debug_configurations_01.png" alt="Debug Configurations dialog" width="873" height="662"><br>
<br>
</li>
<li>Double-click <strong>C/C++ Application</strong> to create a new launch configuration.<br>
<br>
<img src="../images/cdt_w_debug_configurations_02.png" alt="C/C++ Application debug configuration" width="763" height="601"><br>
<br>
<p>If a project is selected in the <a href="../reference/cdt_u_project_explorer_view.htm">Project Explorer</a> view the following data is automatically entered, take a moment to verify its accuracy or change as needed. <br>
<br>
</p>
<ol style="list-style-type: lower-alpha;">
<li>In the <strong>Name</strong> edit box, type the project name, like <strong>Hello World</strong>.<br>
<br>
You can now select this debug launch configuration by name the next time
that you debug this project.<br>
<br>
</li>
<li>In the <strong>C/C++ Application</strong> edit box, type the name of the executable if its not already entered. <br>
<br>
If not, click the <strong>Search Project</strong> button to locate the executable in the project.<br>
<br>
</li>
<li>
<p>In the <strong>Project</strong> edit box, type or choose your project, e.g. <strong>HelloWorld</strong>.<br>
</p>
<p>&nbsp;</p>
<p><strong>NOTE</strong> If you see the error "<span class="typewriter">[Debugger]: No debugger available</span>", select the <strong>Debugger</strong> tab
and choose a valid debugger for your platform (e.g. <span class="typewriter">gdb/mi</span>). <br>
<br>
</p>
</li>
</ol>
</li>
<li>Click <strong>Debug</strong>.<br><br>
<p>You may be prompted to switch to the <strong>Debug</strong> perspective. Click <strong>Yes</strong></p><br>
<p>The <strong>Debug</strong> perspective appears with the <span class="typewriter">helloworld.exe</span> application window open.
The C/C++ editor repositions in the perspective.</p>
<br>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>NOTE:</strong> If you see the error "<span class="typewriter">Can't find source file</span>" in the editor view, use the <strong>Locate File</strong> button
to locate your source file.<br>
</p>
<br>
</li>
<li>In the left margin of the <span class="typewriter">main.cpp</span> window, double-click to set a
breakpoint on:<br>
<br>
&nbsp;<span class="typewriter">cout &lt;&lt; <q>You just entered</q>
</span><br>
<br>
You'll see a blue circle (<img src="../images/icon_breakpoint_obj.gif" alt="Breakpoint" width="16" height="16">) there indicating the breakpoint is set.</br>
<br>
<br>
</li>
<li>Click <strong>Run &gt; Resume</strong>.
<br>
<br>
Or, you can use the <strong>Resume</strong> button (<img src="../images/icon_db_resume.png" alt="Resume" width="19" height="14">) on the toolbar of the <strong>Debug</strong> view
.<br>
<br>
</li>
<li>When prompted, in the <strong>Console</strong> view, type a value other than 'm', and press Enter.<br>
<br>
The breakpoint will be hit.<br>
<br>
</li>
<li>In the <strong>Variables</strong> view, verify that the variable is not 'm'.<br>
<br>
</li>
<li>Click <strong>Run &gt; Resume</strong>.<br>
<br>
</li>
<li>When prompted, again type a value other than 'm' in the <a href="../reference/cdt_u_console_view.htm">Console</a> view, and press Enter.
<p>The breakpoint will be hit.</p></li>
<li>In the <strong>Variables</strong> view, verify that the variable is not 'm'.<br>
<br>
</li>
<li>In the <strong>Variables</strong> view, right-click the input variable, and select <strong>Change Value...</strong>
and type <strong>'m'</strong> <em>between the single quotes</em> and hit <strong>OK</strong>.<br>
<br>
</li>
<li>Click <strong>Run &gt; Resume</strong>.
<p>The output in the <span class="typewriter">helloworld.exe</span> application window is: &nbsp;&quot;<span class="typewriter">Thank you. Exiting.</span>&quot;
</p></li>
<li>The application terminates and the debug session ends. The <strong>Debug</strong> perspective remains open.</li>
</ol>
<p>To learn more about debugging, see the related debug conceptual topics.</p>
<p> <a href="cdt_w_build.htm">
<img src="../images/ngback.gif" width="16" height="16" alt="Back icon"></a><strong> <a href="cdt_w_build.htm">Back: Building a project</a></strong>&nbsp;&nbsp;&nbsp; </p>
<p><img src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
<br>
<a href="../concepts/cdt_c_over_dbg.htm">Debug overview</a><br>
<a href="../concepts/cdt_c_dbg_info.htm">Debug information</a></p>
<p><img src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
<br>
<a href="../tasks/cdt_o_debug.htm">Debugging</a></p>
<p><img src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
<br>
<a href="../reference/cdt_u_dbg_view.htm">Debug view</a><br>
<a href="../reference/cdt_u_dbg_view.htm">Debug launch controls</a><br>
&nbsp;</p>
<p>
<img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" >
</div></body>
</html>

View file

@ -1,211 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>How to bring C/C++ source files into Eclipse</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>
<body>
<div role="main"><h1>Importing your C/C++ source files into Eclipse</h1>
<p>Using the CVS Repository Exploring perspective, you can check
out modules or directories into existing projects, or create new
projects. A common scenario that you may encounter when starting to use the CDT, is determining how
to bring existing C/C++ source files into Eclipse. There are a number of ways to
do this. The scenarios described below are recommended approaches.</p>
<h2>Creating a project from source files in CVS</h2>
<p>If your existing source tree is managed in CVS, you can use the CVS
Repository perspective to &quot;Checkout As...&quot; any folder in the repository.
The first time you &quot;Checkout As...&quot;, the New Project wizard launches and you need to
create a C or C++ project for the folder. For more information, see
<a href="../tasks/cdt_t_proj_new.htm">Creating a project</a>,
<a href="../tasks/cdt_t_proj_new_with_template.htm">Creating a project via a project template</a> and
<a href="../tasks/cdt_o_proj_files.htm">Working with C/C++ project files</a>.</p>
<p>After you perform a checkout operation, a CVS checkout of the project occurs into the project's location. It is recommended that you eventually add and commit the CDT project files back into CVS.
These files include .project, .cdtproject, and .cdtbuild (for Managed Build projects) and are located at the root folder of each CDT project.</p>
<p>
Bringing code into the IDE from CVS differs slightly, depending on what
you're importing:
</p>
<ul>
<li>an existing C/C++ project
</li>
<li>existing C/C++ code that isn't part of a project
</li>
<li>
existing C/C++ code that needs to be added to an existing project
</li>
</ul>
<h3>Importing a C/C++ project from CVS</h3>
<p>
To check out an existing C/C++ project from the CVS repository into your workspace, right-click the project in the CVS Repositories view, and select <strong>Check Out</strong> from the menu. A project with the same name as the CVS module is checked out in to your workspace.
</p>
<h3>Importing C/C++ code from CVS</h3>
<p>
To check out existing C/C++ code that is not part of a project:
</p>
<ol>
<li>
Right-click the module or directory in the CVS
Repositories view and choose <strong>Check Out As...</strong>
from the menu.
<p>
The Check Out As wizard displays.
</p>
</li>
<li>
Choose how to check out this project:
<ul>
<li>
as a project configured using the New Project
wizard
<p>
or:
</p>
</li>
<li>
as a new project in the workspace
<p>
or:
</p>
</li>
<li>
as a Standard Make C/C++ Project - if you need to create your own
Makefile to integrate with an existing build
process
</li>
</ul>
<p>
Choose the workspace location for this project, then the CVS
tag to check out.
<li>Click <strong>Finish</strong> to exit the <strong>Check Out As</strong> dialog.
</p>
<li>Click <strong>Next</strong> to continue.
</ol>
<h3>Importing C/C++ code into an existing project</h3>
<p>
To import a directory full of C/C++ code into an existing project:
</p>
<ol>
<li>
Right-click the module or directory in the CVS
Repositories view and choose <strong>Check Out As</strong>
from the menu.
<p>
The IDE displays the Check Out As dialog.
</p>
<li>Choose <strong>Check out into an existing project</strong>, and then click
<strong>Next</strong>.
The IDE displays the Check Out Into dialog:
</li>
<li>
Select an existing project from the list, and then
click <strong>Finish</strong> to add the code from CVS to the selected
project.
</li>
</ol>
<h2>Creating new projects from existing source roots</h2>
If your resource code is not managed in CVS but is available from the file system, then you need to perform two steps:
<ol>
<li>Identify a "root folder" of your source code tree.</li>
<li>Create a new C/C++ project using the New Project Wizard, and specify the "root folder" as a non-default location of the new project.</li>
</ol>
<p>Typically, existing projects will have their own makefiles, so you should create a new Make C/C++ project. For more information see
<a href="../tasks/cdt_t_proj_new.htm">Creating a project</a> and
<a href="../tasks/cdt_o_proj_files.htm">Working with C/C++ project files</a>.</p>
<p>To help you to identify a root folder for your project, consider the following guidelines:
<ul>
<li>all source code for the project is available on or beneath the root folder</li>
<li>the build results are also produced in or beneath the root folder</li>
<li>there is often a makefile in the root folder. In complex projects, the makefile in the root folder calls other makefiles in other directories to produce the build results.</li>
<li>external header files and library files do not need to be in or beneath the root folder.</li>
</ul></p>
<p>The resources for the project are maintained in the remote location specified,
not in the workspace folder for Eclipse. However, your existing folder structure
is displayed in the C/C++ Projects view. Meta data for the project, such as the
index for the project and the link to the existing source, is stored in the metadata
directory in the workspace folder. For more information on the workspace folder,
see <strong>Workbench User Guide &gt; Tasks &gt; Upgrading Eclipse</strong>.</p>
After you create a CDT project, you cannot easily move it or redefine its root folders.
If you need to, you can delete the CDT project (without deleting its contents) and then
recreate it specifying a different non-default location.
<h2>Import your C/C++ source file system</h2>
<p>Another approach would be to create a C/C++ Project and then import your
existing file system.
For more information about importing, see <strong>Workbench User Guide &gt; Tasks &gt; Importing &gt;
Importing resources from the file system</strong>.</p>
<p>This approach copies the files from your file system to an Eclipse Workbench
project or folder. Your original source files remain unchanged and it is the
copies of the files that will be edited, built and debugged using the CDT.&nbsp;
When you have successfully imported your existing file system, the folder
structure is displayed in the C/C++ Projects view. Again, you should identify an
appropriate "root folder" to import from.</p>
<h3>Tip:</h3>
<p>
<ul>
<li>Importing your existing file system can consume significant disk space
depending on the size of your files.</li>
<li>Your files may become detached from an existing source control system that
previously referenced the original file location such as a ClearCase view.</li>
</ul></p>
<p><img src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
<br>
<a href="../concepts/cdt_c_over_cdt.htm">Overview of the CDT</a><br>
&nbsp;<a href="../concepts/cdt_c_projects.htm">CDT Projects</a></p>
<p><img src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
<br>
<a href="../tasks/cdt_o_proj_files.htm">Working with C/C++ project files</a></p>
<p><img src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
<br>
<a href="../reference/cdt_o_proj_prop_pages.htm">Project properties</a></p><p>
<img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" >
</div></body>
</html>

View file

@ -1,148 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>CDT Importing an Existing Managed Make Project Tutorial</title>
<link rel="stylesheet" type="text/css" href="../help.css">
<script language="JavaScript">
function newWin(url) {
window.open(url, 'install_cdt', 'width=950, height=700, menubar=no, toolbar=no, status=no, resizable=yes, location=no, scrollbars=yes');
}
</script>
</head>
<body>
<div role="main"><h1>Tutorial: Importing an existing project</h1>
<p>The following tutorial takes you though the process of importing a 'legacy' application using the CDT.</p>
<p>Step 1: You want to create a single project that will reflect all of the components for the existing source tree.<br></p>
<ol>
<li>Select <strong>File &gt; New &gt; Project</strong>.</li>
<li>For this tutorial, expand <strong>C/C++</strong> and select <strong>C++ project</strong>.
<p><br>
The <strong>New Project</strong> wizard displays.
<a href="javascript:void(0)" onClick="newWin('../images/cdt_w_import02.png')">Click
here to see an illustration (displayed in a separate window)</a>.</p>
<br></li>
<li>In the <strong>Project name</strong> field, type a name for the project.</li>
<li>Ensure that the <strong>Use default location</strong> option is not selected because here we will specify where the
resources reside in the file system, in a location other than your workspace. <br>
We assume this directory location already exists, and contains e.g. source files and makefile. If it does not exist, it
will be created.
<p>In this example, we will use an existing <code>hello.cpp</code> and its
existing <code>hello.mak</code> makefile, located in the directory <code>c:\brandon</code>.
<p>&nbsp;
<a href="javascript:void(0)" onClick="newWin('../images/cdt_w_importBrandon01.png')">Click
here to see an illustration (displayed in a separate window)</a>.</p>
</li>
<li>In the <strong>Location</strong> field, specify the path to the existing files for your project.</li>
<li>From the <strong>Project types</strong> list, expand <strong>Makefile Project</strong> and select <strong>Empty Project.</strong>.
<ul>
<li>To have sample source and a makefile created in your existing directory, select <strong>Hello World C++ Project</strong></li>
</ul></li>
<li>Make sure a toolchain is selected.</li>
<li>Click <strong>Next</strong>.
<p>&nbsp;</p></li>
<li>(Optional) On the <strong>Select Configurations</strong> page, select only the configurations you want created. Configurations
display for each toolchain selected on the previous page of the wizard.</li>
<li>Click <strong>Finish</strong> to close the dialog box.
<p>You will see the new project in the Project Explorer view. In addition, new 'dot' files have been created in
your legacy project's root directory, these are CDT project files.</p>
<ul>
<li>(Optional) To see these "hidden" files, open the view menu on the Project explorer view, and select
"Customize View." <br>
The view menu is activated via the small downward-pointing triangle in the upper right of the toolbar of the view.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_viewMenu.png')">Click here to see an
illustration (displayed in a separate window)</a>.</p>
<br></li>
<li>In the <strong>Available Customizations</strong> window, on the <strong>Filters</strong> tab, uncheck ".* resources."
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_viewMenuFilters.png')">Click here to see an
illustration (displayed in a separate window)</a>.</p>
<br></li>
<li>The formerly hidden 'dot' files are now shown in the <strong>Project Explorer</strong>.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_viewMenuFilters2.png')">Click here to see an
illustration (displayed in a separate window)</a>.</p>
<br>
</li>
<li>Hit <strong>OK</strong> to close the dialog.</li>
</ul>
</li>
</ol>
<p>Step 2: You are now ready to build your project.<br></p>
<ol>
<li>To build your project, select <strong>Project</strong> &gt; <strong>Build Project</strong>.
<br>You can also hit the hammer icon <img src="../images/hammer-icon.png" alt="build icon"> on the toolbar to
build the selected project.
<br>&nbsp;</br></li>
<li>You may see an error e.g. <code> "make: *** no rule to make target 'all'.</code>
<p>This is because, in our case, we didn't tell it where the makefile is, or its name.</p>
<ul>
<li>Open the project properties (right mouse on project name in the <strong>Project Explorer</strong> view
and select <strong>Properties</strong> at the bottom on the context menu).</li>
<li>On the C/C++ Build Page, on its <strong>Builder Settings</strong> tab, uncheck <q>Use default build command</q>
and change the <code>make</code> command to <code>make -f hello.mak</code>
since our makefile is not named the default <code>makefile</code>.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_importBrandon02.png')">Click
here to see an illustration (displayed in a separate window)</a>.</p>
</li>
<li>Click <strong>OK</strong> to close the <strong>Project Properties</strong> window.
</li>
<li>Your project will probably rebuild. If not you can force a build via
<strong>Project</strong> &gt; <strong>Build Project</strong>
or use the hammer icon <img src="../images/hammer-icon.png" alt="build icon">.
</li>
</ul>
<p>After the project build completes, the results display in the <strong>Console</strong> view and new objects, such as binaries and includes, show in the <strong>Project Explorer</strong> view.</p>
<p>&nbsp;
<a href="javascript:void(0)" onClick="newWin('../images/cdt_w_importBrandon03.png')">Click
here to see an illustration (displayed in a separate window)</a>.</p><br></li>
<li>Review the results to ensure that there are no errors.
<p>&nbsp;
<p></p>
<strong>Note:</strong> By default, the indexer is set to <strong>Fast indexer</strong> for the project to parse your project in the same way that a compiler does; beginning with each compilation unit and parsing that file and all files that it includes, except that it parses each header file included in a project only once. This method provides the most accurate index information. For large projects using complex C++ code, this indexer can be slow. For example, if a header file is included and takes two compilation units, the parsing of the second unit reuses the results of parsing the first unit. This is similar to how precompiled headers work. The indexing of large projects using the Fast indexer uses fewer resources than the Full indexer, but the resulting index is not quite as accurate.
<br>To change indexer settings, bring up the Indexer page in the Project Properties.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_indexer.png')">Click here to see an illustration (displayed in a separate window)</a>.</p> <br>
</br>
</p>
</li>
</ol>
<p>Step 3: You are now ready to run your application.</p>
<ol>
<li>To run your application within the C/C++ Perspective, click <strong>Run &gt; Run Configurations...</strong><p>
<p>The <strong>Run Configurations</strong> dialog displays.</p>
<li>To create a run configuration, select <strong>C/C++ Application</strong> and click the <strong>New</strong> icon.
<li>Give your run configuration a name by entering a new name in the <strong>Name</strong> field at the top.
<li>On the <strong>Main</strong> tab, select the project by clicking <strong>Browse</strong> opposite the <strong>Project</strong> field.
<ul>
<li>From the Project Selection window, select the project and click <strong>OK</strong>.
</ul><li>Select the new <strong>C/C++ Application</strong> you want to execute by clicking <strong>Search</strong>.
<p>In our case it didn't find the file because it's in a nonstandard location.
Use the <strong>Browse</strong> button to select the executable. In our case also it's a nonstandard
name, <code>hello.e</code> because that's what our makefile <code>hello.mak</code> built.</p>
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_importBrandon04run.png')">Click
here to see an illustration (displayed in a separate window)</a>.</p>
<ul>
<li>If you see the error <q>[Debugger]: No debugger available</q>, select the Debugger tab
and choose a valid debugger for your platform (e.g. gdb/mi).
</li>
</ul>
<li>Click <strong>Run</strong> to save the run configuration and run it.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_importBrandon04run2.png')">Click
here to see an illustration (displayed in a separate window)</a>.</p>
<p>The application runs in the <strong>Console</strong> view. The <strong>Console</strong> also shows which application it is currently running in the title bar. You can configure the view to display different elements, such as user input elements using different colors.</p>
</ol>
<img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" >
</div></body>
</html>

View file

@ -1,87 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Updating the CDT</title>
<link rel="stylesheet" type="text/css" href="../help.css">
<!--
<script language="JavaScript">
function changeSize(theImage,wd,ht) {
wdth=parseInt(theImage.style.width); hght=parseInt(theImage.style.height);
if ( !(wdth==(wd*2)) ) {wdth=wd*2; hght=ht*2;}
else {wdth=wd;hght=ht;}
theImage.style.width=wdth; theImage.style.height=hght;
}
</script>
-->
<script language="JavaScript">
function newWin(url) {
window.open(url, 'install_cdt', 'width=900, height=700, menubar=no, toolbar=no, status=no, resizable=yes, location=no, scrollbars=yes');
}
</script>
</head>
<body>
<div role="main"><h1>Installing and updating the CDT</h1>
<p>You can use the Software Updates manager to quickly install or update the CDT directly from the Eclipse workbench using your internet connection.</p>
<p>To obtain the latest CDT features:</p>
<ol>
<li>Select <strong>Help &gt; Software Updates &gt; Find and Install</strong>.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_update_find-install.png')">Click here to see an illustration (displayed in a separate window)</a>.</p>
<br></li>
<li>In the <strong>Feature Updates</strong> window, select <strong>Search for new features to install</strong> and click <strong>Next</strong>.<br><p>Note: If you want to search for updates on features that you currently have installed, you can select the option <strong>Search for updates of the currently installed features</strong>, and then follow the steps to update using that method.</p><p><a href="javascript:void(0)" onClick="newWin('../images/cdt_update_install_new.png')">Click here to see an illustration</a>.</p>
<br></li>
<li>If you have not updated previously, you will have to enter the location of the Eclipse CDT Install site. Click <strong>New Remote Site...</strong>.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_update_install_sites.png')">Click here to see an illustration</a>.</p>
<br></li>
<li>In the New Update Site dialog box, type the name and URL for the Eclipse update site.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_update_install_new_sites.png')">Click here to see an illustration</a>.</p><br></li>
<li>Click <strong>OK</strong>.<p><br></p></li>
<li>From the <strong>Sites to include in search</strong> list, select the update site you just created by clicking the appropriate check box, and click <strong>Finish</strong>.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_update_install_cdt_site.png')">Click here to see an illustration</a>.</p>
<br></li>
<li>The Search Results dialog shows the features available to install from the update site. Expand and select any additional features that you require. De-select any options that do not apply to you.<p><br></p></li>
<li>Click <strong>Next</strong>.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_update_search_results.png')">Click here to see an illustration</a>.</p><br>
</li>
<li>You must accept the Eclipse.org Software User Agreement to continue installing the CDT update. If you accept the terms, select <strong>I accept the terms in the license agreement</strong> and then click <strong>Next</strong>.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_update_license_agreement.png')">Click here to see an illustration</a>.</p>
<br>
<p>You can review the summary list of the features you selected to install.<br></p><br></li>
<li>Optional: Click <strong>Change Location</strong> to select the location you would like the updates installed. Typically, this is the directory where you installed Eclipse.<p><br></p></li>
<li>Click <strong>Finish</strong>.<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_update_location.png')">Click here to see an illustration</a>.</p>
<br></li>
<li>You will now start downloading the CDT components. You will have to verify that you want the features installed by clicking
<strong>Install</strong> for each feature you selected.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_update_jar_verification.png')">Click here to see an illustration</a>.</p>
<br><p>Now, you have to restart Eclipse. </p><br></li>
<li>Select <strong>Yes</strong> to complete the feature installation process.
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_restart.png')">Click here to see an illustration</a>.</p>
</ol>
<p><img src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
<br>
<a href="../concepts/cdt_c_over_cdt.htm">CDT Overview</a><br>
<a href="../concepts/cdt_c_perspectives.htm">C/C++ Development perspective</a><br>
&nbsp;</p>
<img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" > </p>
</div></body>
</html>

View file

@ -1,98 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Creating your C++ file</title>
<link rel="stylesheet" type="text/css" href="../help.css">
</head>
<body>
<div role="main"><h1>Creating your C++ file</h1>
<p>You can begin coding your HelloWorld program. The .cpp file that you
create will be saved in the project folder you just created
<a href="cdt_w_newproj.htm">Creating a Makefile project</a>.</p>
<p>Files are edited in the C/C++ editor located to the right of
the C/C++ Projects view. The left margin of the C/C++ editor, called the marker
bar, displays icons for items such as bookmarks, breakpoints, and compiler errors and warnings.</p>
<p>For more information about:</p>
<ul>
<li>The editor area and marker bar, see <strong>Workbench User Guide &gt; Reference &gt; User interface
information &gt; Views and editors &gt; Editor area</strong></li>
<li>The marker bar icons, see <strong>Workbench User Guide &gt; Reference &gt; User interface
information &gt; Icons and buttons &gt; Editor area marker bar</strong></li>
</ul>
<p>To create a C++ file:</p>
<ol>
<li>In the <strong>Project Explorer</strong> view, right-click the <strong>HelloWorld</strong> project
folder, and select <strong>New &gt; Source File</strong>.</li>
<li>In the <strong>Source file: </strong> field, type <strong>main.cpp</strong>.
<br>By default the source folder should be your project folder.
<br>The template selected is probably <q>Default C/C++ Source Template.</q>
</li>
<li>Click <strong>Finish</strong>.</li>
<li>A Comment template probably appears at the top of an otherwise empty file.
Type the code, exactly as it appears below, in the editor.
Or you can paste it in from this help file.
<pre>
#include &lt;iostream&gt;
using namespace std;
int main () {
// Say HelloWorld five times
for (int index = 0; index &lt; 5; ++index)
cout &lt;&lt; &quot;HelloWorld!&quot; &lt;&lt; endl;
char input = 'i';
cout &lt;&lt; &quot;To exit, press 'm' then the 'Enter' key.&quot; &lt;&lt; endl;
cin >> input;
while(input != 'm') {
cout &lt;&lt; &quot;You just entered '&quot; &lt;&lt; input &lt;&lt; &quot;'. &quot;
&lt;&lt; &quot;You need to enter 'm' to exit.&quot; &lt;&lt; endl;
cin >> input;
}
cout << "Thank you. Exiting." << endl;
return 0;
}
</pre>
</li>
<li>Click <strong>File &gt;
Save</strong>.</li>
</ol>
<p>Your new .cpp file is displayed in the <strong>Project Explorer</strong> view. Your project now contains main.cpp. Before you
can build your HelloWorld project, you must create a makefile.</p>
<p>
<a href="cdt_w_newmake.htm" style="text-decoration: none">
<img src="../images/ngnext.gif" width="16" height="16" alt="Next icon"></a> <strong><a href="cdt_w_newmake.htm">Next: Creating your makefile </a> </strong>
</p>
<p><a href="cdt_w_newproj.htm" style="text-decoration: none">
<img src="../images/ngback.gif" width="16" height="16" alt="Back icon"></a> <strong><a href="cdt_w_newproj.htm">Back: Creating your project</a></strong></p>
<p><img src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
<br>
<a href="../concepts/cdt_c_projects.htm">CDT projects</a><br>
<a href="../concepts/cdt_c_proj_file_views.htm">Project file views</a><br>
<a href="../concepts/cdt_o_code_entry.htm">Coding aids</a></p>
<p><img src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
<br>
<a href="../tasks/cdt_o_proj_files.htm">Working with C/C++ project files</a><br>
<a href="../tasks/cdt_o_write_code.htm">Writing code</a></p>
<p><img src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
<br>
<a href="../reference/cdt_o_proj_prop_pages.htm">C/C++ Projects view</a></p>
<p>
<img src="../images/ng00_04a.gif" ALT="IBM Copyright Statement" >
</div></body>
</html>

View file

@ -1,83 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Creating your makefile</title>
<link rel="stylesheet" type="text/css" href="../help.css">
<script language="JavaScript">
function newWin(url) {
window.open(url, 'install_cdt', 'width=750, height=700, menubar=no, toolbar=no, status=no, resizable=yes, location=no, scrollbars=yes');
}
</script>
</head>
<body>
<div role="main"><h1>Creating a makefile</h1>
<p>For the purpose of this tutorial, you were instructed to create a C++ Project which requires you to create a makefile.</p>
<p>To create a makefile:</p>
<ol>
<li>In the <strong>Project Explorer</strong> view, right-click the <strong>HelloWorld</strong> project
folder and select <strong>New &gt; File</strong>.</li>
<li>In the <strong>File name</strong> box, type <strong>makefile</strong>.</li>
<li>Click <strong>Finish</strong>.</li>
<li>Type the gnu make instructions below in the editor. Lines are
indented with tab characters, not with spaces.
<blockquote>
<p>
<br>
all: hello.exe<br>
<br>
clean:<br>
&nbsp;&nbsp;&nbsp; rm main.o hello.exe<br>
<br>
hello.exe: main.o<br>
&nbsp;&nbsp;&nbsp; g++ -g -o hello main.o<br>
<br>
main.o:<br>
&nbsp;&nbsp;&nbsp; g++ -c -g main.cpp<br>
&nbsp;</p>
</blockquote>
</li>
<li>Click <strong>File &gt;
Save</strong>.</li></ol>
<p>Your new makefile, along with your main.cpp file are
displayed in the Project Explorer view. Your project now
contains main.cpp and makefile. You can now build your HelloWorld project.</p>
<p>NEW <a href="javascript:void(0)" onClick="newWin('../images/cdt_w_newmake02.png')">Click here to see an illustration</a>.</p>
<p>
<a href="cdt_w_build.htm" style="text-decoration: none">
<img src="../images/ngnext.gif" width="16" height="16" alt="Next icon"></a>
<strong><a href="cdt_w_build.htm">
Next: Building your project</a> </strong>
</p>
<p>
<a href="cdt_w_newcpp.htm">
<img src="../images/ngback.gif" width="16" height="16" alt="Back icon"></a> <strong><a href="cdt_w_newcpp.htm">Back: Creating your C++ file</a></strong> </p>
<p><img src="../images/ngconcepts.gif" ALT="Related concepts" width="143" height="21">
<br>
<a href="../concepts/cdt_c_projects.htm">Project</a><br>
<a href="../concepts/cdt_o_code_entry.htm">Code entry</a></p>
<p><img src="../images/ngtasks.gif" ALT="Related tasks" width="143" height="21">
<br>
<a href="../tasks/cdt_o_proj_files.htm">Working with C/C++ project files</a><br>
<a href="../tasks/cdt_o_write_code.htm">Writing code</a></p>
<p><img src="../images/ngref.gif" ALT="Related reference" width="143" height="21">
<br>
<a href="../reference/cdt_o_proj_prop_pages.htm">C/C++ Projects view</a></p>
<p>
<img src="../images/ng00_04a.gif" ALT="IBM Copyright Statement" >
</div></body>
</html>

View file

@ -1,120 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="content-language" content="en-us">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Creating your project</title>
<link href="../help.css" type="text/css" rel="stylesheet">
<script language="JavaScript">
function newWin(url) {
window.open(url, 'install_cdt', 'width=750, height=700, menubar=no, toolbar=no, status=no, resizable=yes, location=no, scrollbars=yes');
}
</script>
</head>
<body>
<div role="main"><h1>Creating a Makefile project</h1>
<p>
This tutorial describes the process of creating a new C++ project that includes a makefile, and debugging the program.</p>
<p>You need to create a project to contain your source code and related files. A project has an associated builder
that can incrementally compile source files as they are changed.</p>
<p>To create a project:</p>
<ol>
<li>Select <strong>File &gt; New &gt; Project</strong>.
<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>
<li>Select the type of project to create. For this tutorial, expand the <strong>C/C++</strong> folder and select <strong>C++ Project</strong>.
<br><p>The <strong>C++ Project</strong> wizard opens. <a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic19.png')">Click here to see an illustration.</a></p><br>
<p>By default, the CDT filters the <strong>Toolchain</strong> and <strong>Project types</strong> that currently display in those lists are based on the language support for the C++ Project wizard you selected for this tutorial.</p><br>
<li>In the <strong>Project name</strong> field, type HelloWorld.
<li>Leave the <strong>Use Default Location</strong> option selected.
<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>
<ul>
<li><strong>Executable</strong> - Provides an executable application. This project type folder contains three templates.</p>
<ul>
<li><strong>Hello World C++ Example</strong> provides a simple C++ Hello World application with main().
<li><strong>Hello World ANSI C Example</strong> provides a simple C Hello World application with main().
<li><strong>Empty Project</strong> provides a single source project folder that contains no files.
<p>After you select this template, the result is a project with only the meta-data files required for the project type.
You are expected to provide source files for the project's target.</p>
</ul>
<p>The makefile for the <strong>Executable</strong> project type is automatically created by the CDT.</p>
<p>&nbsp;</p>
<li><strong>Shared Library</strong> - 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
libxx.so.<var>version</var>, where
<var>version</var> is a number with a default of 1. The
libxx.so file usually is a symbolic link to the
latest version. The makefile for this project type is automatically created by the CDT.
<li><strong>Static Library</strong> - A collection of object files that you can link into another application (libxx.a). The CDT combines object files (i.e. *.o)
into an archive (*.a) that is directly linked into an
executable. The makefile for this project type is automatically created by the CDT.
<li><strong>Makefile Project</strong> - 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.
</ul>
<p>By default, the CDT filters the <strong>Toolchain</strong> and <strong>Project types</strong> that currently display in those lists based on the language support for the C++ Project wizard you selected for this tutorial.
<p>&nbsp;</p>
<li>From the <strong>Project types</strong> list, expand <strong>Makefile project</strong> and select <strong>Empty Project</strong>.
This project lets you enter the source file and the makefile yourself.
<li>Select a required toolchain from the <strong>Toolchain</strong> list.
<p>A toolchain is a set of tools (such as a compiler, linker, and assembler) intended to build your project.
Additional tools, such as a debugger, can be associated with a toolchain.<br>
There can be several toolchains available, depending on the compilers installed on your system.
</p>
</li>
<li>Click <strong>Next</strong>.
<li>(Optional) On the <strong>Select Configurations</strong> page, Click <strong>Advanced Settings</strong>.
<ul>
<li>Expand <strong>C/C++Build > Settings</strong>. Click the <strong>Binary Parsers</strong> tab.
<p><br><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_binparser01.png')">Click here to see an illustration.</a></p><br>
</p>
</li>
<li>In the <strong>Binary Parser</strong> list, select the error parser that is appropriate for your platform.
Other project settings can be modified here as well. The default selection is probably OK.
<br>
<p>To ensure the accuracy of the C/C++ Projects view and the ability to successfully
run and debug your programs, selecting the correct parser is important. After
you select the correct parser for your development environment and build your
project, you can view the components of the .o file in the C/C++ Projects
view. You can also view the contents of the .o file in the C/C++ editor.
</p><br>Click <strong>OK</strong> to close the Project Properties window.</li>
</ul>
<li>Click <strong>Finish</strong>.</li>
<li>If a message box prompts you to change perspectives, click <strong>Yes</strong>.
</li>
</ol>
<p>Your new project displays in the Project Explorer view.
Your project is empty because you have not yet created
files for your project.
You may see an error since there is nothing to build yet for your project.
You can now start writing the code for your HelloWorld
program.</p>
<p><strong>Tip:</strong> You can view and modify the properties of your
HelloWorld project at any time by right-clicking on the project in the <strong>Project Explorer</strong>
view and clicking Properties.</p> <p><a style="text-decoration: none" href="cdt_w_newcpp.htm"><img
src="../images/ngnext.gif" height="16" width="16" alt="Next Icon"></a> <a href="cdt_w_newcpp.htm"><strong>
Next: Creating your C++ file</strong></a></p> <p>For more information
about:</p> <ul>
<li>Projects, see <strong>Workbench User Guide > Concepts > Workbench > Resources
</strong></li>
<li>The workspace, see <strong>Workbench User Guide > Tasks > Upgrading Eclipse
</strong></li>
</ul> <p><img src="../images/ngconcepts.gif" alt="Related concepts" height="21" width="143"
> <br> <a href="../concepts/cdt_c_over_cdt.htm">CDT overview</a><br> <a href="../concepts/cdt_c_projects.htm">
CDT projects</a><br> <a href="../concepts/cdt_c_proj_file_views.htm">Project file views
</a></p> <p><img src="../images/ngtasks.gif" alt="Related tasks" height="21" width="143"
> <br> <a href="../tasks/cdt_o_proj_files.htm">Working with C/C++ project files</a></p> <p><img
src="../images/ngref.gif" alt="Related reference" height="21" width="143" > <br> <a
href="../reference/cdt_o_proj_prop_pages.htm">C/C++ Projects view</a></p>
<p><img src="../images/ng00_04a.gif" ALT="QNX Copyright Statement" ></p>
</div></body>
</html>

View file

@ -1,85 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Preparing the Workbench</title>
<link rel="stylesheet" type="text/css" href="../help.css">
<script type="text/javascript"
src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"></script>
</head>
<body>
<div role="main">
<h1>Preparing the Workbench</h1>
<p>This tutorial will get you started using the C/C++ Development
Toolkit (CDT) in the Workbench.</p>
<p>First, you will verify that the workbench is properly
configured for C/C++ development. It is assumed that:</p>
<ul>
<li>Your Workbench has its default settings. To reset the
current perspective to its original layout, from the menu bar select
<strong>Window &gt; Reset Perspective</strong>.
</li>
<li>You are familiar with the basic Workbench features, such as
<a href="../concepts/cdt_c_views.htm">views</a> and <a
href="../concepts/cdt_c_perspectives.htm">perspectives</a>.
</li>
</ul>
<h2>Setting the global editor operations and appearance</h2>
<p>
The main place to configure global editor-related preferences is the
<a class="command-link"
href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Editors)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png"
alt="command link" />General &gt; Editors
</a> preference pages (also accessible through the <strong>Window
&gt; Preferences</strong> menu item)
</p>
<h2>Setting the C/C++ editor operations and appearance</h2>
<p>
C/C++-specific editor preferences are under <a class="command-link"
href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.cdt.ui.preferences.CEditorPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png"
alt="command link" />C/C++ &gt; Editor.
</a> They include the following:
</p>
<ul>
<li><a href="../reference/cdt_u_c_editor_gen.htm">Editor</a> -
control the appearance of text highlighting</li>
<li><a href="../reference/cdt_u_c_editor_con_assist.htm">Content
Assist </a>- customize the Content Assist feature</li>
<li><a href="../reference/cdt_u_c_editor_folding.htm">Folding</a>
- customize folding behavior</li>
<li><a href="../reference/cdt_u_c_editor_hov.htm">Hovering</a> -
customize hover behavior</li>
<li><a href="../reference/cdt_u_c_editor_mark_occurrences.htm">Mark
Occurrences</a> - set annotations</li>
<li><a href="../reference/cdt_u_c_editor_save_actions.htm">Save
Actions</a> - configure actions performed while saving a file</li>
<li><a href="../reference/cdt_u_c_editor_scalability.htm">Scalability</a>
- configure behavior for handling large source files</li>
<li><a href="../reference/cdt_u_c_editor_color.htm">Syntax
Coloring</a> - specify how C/C++ source code is rendered</li>
<li><a href="../reference/cdt_u_c_code_templates_pref.htm">Templates</a>
- configure the format of newly generated code stubs, comments and
files</li>
<li><a href="../reference/cdt_u_c_editor_typing.htm">Typing</a>
- configure formatting input as you type</li>
</ul>
<p>
<img src="../images/ngref.gif" alt="Related reference"> <br>
<a href="../reference/cdt_o_ceditor_pref.htm">C/C++ Editor
Preferences</a>
</p>
<p>
<img alt="Red Hat Copyright Statement" src="../images/rh03_04.gif"><br>
<img alt="IBM Copyright Statement" src="../images/ng00_04a.gif">
</p>
</div>
</body>
</html>

View file

@ -1,31 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>C++ Hello World example</title>
</head>
<body style="background-color:#ffffcc;">
<div role="main">
<pstyle="color:#0066ff">Copy the code below and paste it into the <strong>main.cpp</strong> file in the Editor view:</p>
<pre>
#include &#60iostream&#62
#include &#60string&#62
using namespace std;
int main()
{
string yourName;
cout &lt;&lt; "Type your name: ";
cin &gt;&gt; yourName;
cout &lt;&lt; "Hello " + yourName &lt;&lt; endl;
return 0;
}
</pre>
</div></body>
</html>

View file

@ -1,27 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>C++ Makefile example</title>
</head>
<body style="background-color:#ffffcc;">
<div role="main">
<p style="color:#0066ff">Copy the script below and paste it into the <strong>makefile</strong> file in the Editor view:</p>
<pre>
all: hello
clean:
-rm main.o hello.exe hello
hello: main.o
g++ -g -o hello main.o
main.o: main.cpp
g++ -c -g main.cpp
</pre>
</div></body>
</html>

View file

@ -17,7 +17,7 @@ h1 { font-size: 18pt; margin-top: 5; margin-bottom: 1 }
h2 { font-size: 14pt; margin-top: 25; margin-bottom: 3 }
h3 { font-size: 11pt; margin-top: 20; margin-bottom: 3 }
h4 { font-size: 10pt; margin-top: 20; margin-bottom: 3; font-style: italic }
h5 { font size: 13.5pt; }
h5 { font-size: 13.5pt; }
p { font-size: 12pt; }
pre { margin-left: 6; font-size: 9pt }
@ -60,37 +60,3 @@ div.linux {display:none;}
.bold {font-weight:600;}
.linethrough {text-decoration: line-through;}
.underline {text-decoration: underline;}
/* AsciiDoc support based on Asciidoctor default stylesheet | MIT License | http://asciidoctor.org (#873) */
p.tableblock { margin: 0 }
table.tableblock tr th, table.tableblock tr td { padding: 0.3em }
table.tableblock, th.tableblock, td.tableblock { border: 0 solid #dedede }
table.grid-all>thead>tr>.tableblock, table.grid-all>tbody>tr>.tableblock { border-width: 0 1px 1px 0 }
table.grid-all>tfoot>tr>.tableblock { border-width: 1px 1px 0 0 }
table.grid-cols>*>tr>.tableblock { border-width: 0 1px 0 0 }
table.grid-rows>thead>tr>.tableblock, table.grid-rows>tbody>tr>.tableblock { border-width: 0 0 1px 0 }
table.grid-rows>tfoot>tr>.tableblock { border-width: 1px 0 0 0 }
table.grid-all>*>tr>.tableblock:last-child, table.grid-cols>*>tr>.tableblock:last-child { border-right-width: 0 }
table.grid-all>tbody>tr:last-child>.tableblock, table.grid-all>thead:last-child>tr>.tableblock, table.grid-rows>tbody>tr:last-child>.tableblock, table.grid-rows>thead:last-child>tr>.tableblock { border-bottom-width: 0 }
table.frame-all { border-width: 1px }
table.frame-sides { border-width: 0 1px }
table.frame-topbot { border-width: 1px 0 }
th.halign-left, td.halign-left { text-align: left }
th.halign-right, td.halign-right { text-align: right }
th.halign-center, td.halign-center { text-align: center }
th.valign-top, td.valign-top { vertical-align: top }
th.valign-bottom, td.valign-bottom { vertical-align: bottom }
th.valign-middle, td.valign-middle { vertical-align: middle }
div.listingblock pre { padding: 0.7em }
.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
.admonitionblock>table td.icon{text-align:center;width:80px}
.admonitionblock>table td.icon img{max-width:initial}
.admonitionblock>table td.icon .title{font-weight:bold;text-transform:uppercase}
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8}
.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c}
.admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#bf6900}
.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400}
.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000}

View file

@ -0,0 +1,42 @@
/* AsciiDoc support based on Asciidoctor default stylesheet combined with help.css to match Eclipse Help look and feel | MIT License | http://asciidoctor.org (#873) */
/* Additional entries can be added here as more parts of asciidoc are used */
@import "./help.css";
/* The original help code in CDT relied heavily on <br> to add a bit of
vertical space and had margins set to 0 most places. So for the adoc
version we do it with CSS instead. */
ol li p { margin-top: 0; margin-bottom: 0.5em }
p.tableblock { margin: 0 }
table.tableblock tr th, table.tableblock tr td { padding: 0.3em }
table.tableblock, th.tableblock, td.tableblock { border: 0 solid #dedede }
table.grid-all>thead>tr>.tableblock, table.grid-all>tbody>tr>.tableblock { border-width: 0 1px 1px 0 }
table.grid-all>tfoot>tr>.tableblock { border-width: 1px 1px 0 0 }
table.grid-cols>*>tr>.tableblock { border-width: 0 1px 0 0 }
table.grid-rows>thead>tr>.tableblock, table.grid-rows>tbody>tr>.tableblock { border-width: 0 0 1px 0 }
table.grid-rows>tfoot>tr>.tableblock { border-width: 1px 0 0 0 }
table.grid-all>*>tr>.tableblock:last-child, table.grid-cols>*>tr>.tableblock:last-child { border-right-width: 0 }
table.grid-all>tbody>tr:last-child>.tableblock, table.grid-all>thead:last-child>tr>.tableblock, table.grid-rows>tbody>tr:last-child>.tableblock, table.grid-rows>thead:last-child>tr>.tableblock { border-bottom-width: 0 }
table.frame-all { border-width: 1px }
table.frame-sides { border-width: 0 1px }
table.frame-topbot { border-width: 1px 0 }
th.halign-left, td.halign-left { text-align: left }
th.halign-right, td.halign-right { text-align: right }
th.halign-center, td.halign-center { text-align: center }
th.valign-top, td.valign-top { vertical-align: top }
th.valign-bottom, td.valign-bottom { vertical-align: bottom }
th.valign-middle, td.valign-middle { vertical-align: middle }
div.listingblock pre { padding: 0.7em }
.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
.admonitionblock>table td.icon{text-align:center;width:80px}
.admonitionblock>table td.icon img{max-width:initial}
.admonitionblock>table td.icon .title{font-weight:bold;text-transform:uppercase}
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8}
.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c}
.admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#bf6900}
.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400}
.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000}

View file

@ -43,26 +43,37 @@
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<outputDirectory>${project.basedir}</outputDirectory>
<preserveDirectories>true</preserveDirectories>
<relativeBaseDir>true</relativeBaseDir>
<attributes>
<icons>font</icons>
<iconfont-remote>false</iconfont-remote>
<!--
stylesdir is used for all style sheets, for now we are just using font-awesome so this layout work,
but if we use more stylesheets a better layout may be desired.
-->
<stylesdir>../font-awesome/css</stylesdir>
<imagesdir>../images</imagesdir>
<linkcss />
<reproducible />
<source-highlighter>coderay</source-highlighter>
<coderay-css>style</coderay-css>
<stylesheet>../../helpadoc.css</stylesheet>
<toc>macro</toc>
<!-- to preserve filenames/urls, we use the old htm suffix that files originally had-->
<outfilesuffix>.htm</outfilesuffix>
</attributes>
</configuration>
<executions>
<execution>
<id>adoc-to-html</id>
<id>generate-online-help-from-asciidoc</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/html</outputDirectory>
<attributes>
<icons>font</icons>
<imagesdir>../images</imagesdir>
<linkcss />
<reproducible />
<source-highlighter>coderay</source-highlighter>
<stylesheet>../help.css</stylesheet>
<toc>macro</toc>
</attributes>
</configuration>
</execution>
</executions>
</plugin>
@ -70,6 +81,26 @@
</build>
<profiles>
<profile>
<id>asciidoc-auto-refresh</id>
<build>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-online-help-from-asciidoc-auto-refresh</id>
<phase>generate-resources</phase>
<goals>
<goal>auto-refresh</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>build-doc</id>
<activation>

View file

@ -1,16 +1,16 @@
////
Copyright (c) 2024 John Dallaway and others
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
John Dallaway - initial example AsciiDoc content (#873)
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
@ -18,6 +18,16 @@ ifdef::env-github[]
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
= Example document
toc::[]
@ -63,3 +73,11 @@ int main (int argc, char* argv[]) {
}
----
== Makefiles
*TODO*: How to handle tabs in makefiles? Without tabs Makefile code samples cannot be copied and pasted successfully.
== See also
See also the README.md at the root of this bundle as it has additional help on using AsciiDoc.

View file

@ -0,0 +1,50 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Getting Started
The following tutorials guide you through the process of using the C/{cpp}
Development Toolkit (CDT) to:
* xref:cdt_w_prepare_workbench.adoc[Prepare the Workbench]
* xref:cdt_w_basic.adoc[Create a simple application]
* xref:new_cmake_proj.adoc[Creating a CMake project]
* xref:cdt_w_newproj.adoc[Create a Makefile project]
* xref:cdt_w_import.adoc[Import an existing project]
* xref:cdt_w_newcpp.adoc[Create a {cpp} file]
* xref:cdt_w_newmake.adoc[Create a makefile]
* xref:cdt_w_build.adoc[Build a project]
* xref:cdt_w_debug.adoc[Debug a project]
* xref:cdt_w_existing_code.adoc[Import C/{cpp} source into Eclipse]
* xref:cdt_w_install_cdt.adoc[Install/update the CDT]
image:ngref.gif[Related reference]
* xref:../concepts/cdt_o_home.adoc[CDT Home]

View file

@ -0,0 +1,189 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Tutorial: Creating a simple application
In this tutorial, you will use the CDT to create a simple 'Hello World'
application. This tutorial describes the process of creating a new {cpp}
project where the build is automatically managed by the CDT, and running
the program.
*NOTE*: In earlier versions of the CDT, there were two separate project
types: Managed make (automatically generated a makefile) and Standard
make (required the user's makefile to build). Now with CDT, you just
select a project type, and that determines what build system to use.
To create a simple "Hello World" application using CDT, perform the
following general steps:
. link:#cdt_create[Creating a project]
. link:#cdt_build[Reviewing the code and building the project]
. link:#cdt_running[Running the application]
'''''
=== Step 1: [[cdt_create]]Creating a project
. Select *File > New > Project*.
+
image:cdt_w_basic02.png[Select File > New > Project menu
option,width=591,height=183]
+
. Select the type of project to create. For this tutorial, expand the
*{cpp}* folder and select *{cpp} Project* and click *Next*.
+
image:cdt_w_basic03a.png[Select project
type,width=525,height=500]
+
. The *{cpp} Project* wizard opens.
+
image:cdt_w_basic04.png[{cpp} project
wizard,width=525,height=576]
+
By default, the CDT filters the *Toolchain* and *Project types* that it
displays in those lists based on the language support for the {cpp}
Project wizard you selected for this tutorial.
+
[loweralpha]
.. In the *Project name* field, type a name for the project, such as
*HelloWorld*.
+
.. From the *Project type* list, expand *Executable* and select *Hello
World {cpp} Project*. This project type provides a simple Hello World
application in {cpp}, and the makefile is automatically created by the
CDT.
+
.. Select a required toolchain from the *Toolchain* list.
+
A toolchain is a set of tools (such as a compiler, linker, and
assembler) intended to build your project. Additional tools, such as a
debugger, can be associated with a toolchain. There can be several
toolchains available, depending on the compilers installed on your
system.
+
.. Click *Next*.
+
. Specify the *Basic Properties* for the new project, such as your
author, copyright, and source information, then click *Next*.
+
image:cdt_w_basic06a.png[Basic properties of a
project,width=525,height=576]
+
. The *Select Configurations* page displays a list of configurations
based on the project type and toolchain(s) selected earlier.
+
image:cdt_w_basic07.png[Select configurations
page,width=525,height=576]
+
*OPTIONAL*: If you want to change the default project settings, click
*Advanced Setting* to open the
xref:../reference/cdt_u_prop_all.adoc[Project Properties] dialog for your
new project allowing you change any of the project specific settings,
such as includes paths, compiler options, and libraries.
+
. Click *Finish*.
*NOTE* If the *{cpp} perspective* is not currently set as the default, you
are prompted to determine if you would like to this project to be
associated with the C/{cpp} perspective. Click *Yes*.
A project is created with the default settings and a full set of
configurations based on the project type and toolchain you selected. You
should now see the new project in
xref:../reference/cdt_u_project_explorer_view.adoc[Project Explorer]
view.
image:cdt_w_basic12.png[New project displayed in
the Project Explorer view,width=423,height=283]
'''''
=== Step 2: [[cdt_build]]Reviewing the code and building the project
. From the *Project Explorer* view, double-click the .cpp file created
for your project, for example, [.typewriter]#HelloWorld.cpp#. You'll
find it within the project "[.typewriter]#src#" folder.
+
This file opens in a default editor. It contains {cpp} template code for
the Hello World example project you selected earlier. In addition, the
xref:../reference/cdt_u_outline_view.adoc[Outline] view has also been
populated with objects created from your code.
+
image:cdt_w_basic13.png[C Editor with Outline
view,width=731,height=333]
+
*NOTE:* You can specify a different editor, and add or modify existing
code templates in *Window > Preferences*.
+
*OPTIONAL*: You can type additional code in this file, and then save the
changes by clicking File > Save, or pressing *CTRL+S*.
+
Next, you will need to build your project before you can run it.
+
. Build your project by pressing *CTRL+B*, or select the project in the
*Project Explorer* view and select *Project > Build Project*.
+
*NOTE:* If a build generates any errors or warnings, you can see those
in the xref:../reference/cdt_u_problems_view.adoc[Problems] view. If you
encounter difficulty, see the topics
xref:../concepts/cdt_c_build_over.adoc[Building C/{cpp} projects] and
xref:../concepts/cdt_c_before_you_begin.adoc[Before you begin]
.
. Read through the build messages in the
xref:../reference/cdt_u_console_view.adoc[Console] view. The project
should build successfully.
+
You will also see the *Outline* view has also been populated with
objects created from your code. If you select an item from the *Outline*
view, the corresponding text in the editor is highlighted.
'''''
=== Step 3: [[cdt_running]]Running the application
To run your application:
. Within the C/{cpp} Perspective, click *Run > Run Configurations...*.
+
. Select *C/{cpp} Application*.
+
. Click *New*.
+
A new Run Configuration is created. Its name and path to the executable
are provided by the project ('Hello World' in our case).
. Click *Run*.
+
Now, you should see the Hello World application running in the *Console*
view. The *Console* also shows which application is running in a title
bar.
+
. You can click the other views to see the information that they
contain.

View file

@ -0,0 +1,85 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Building a project
The make output and build progress information displays in the
xref:../reference/cdt_u_console_view.adoc[Console] view. The
xref:../reference/cdt_u_make_targets_view.adoc[Make Targets] view
displays makefile actions, and the
xref:../reference/cdt_u_problems_view.adoc[Problems] view displays
compile warnings or errors.
=== To build a project:
. In the *Project Explorer* view, select your project. For the tutorial,
you can select the *HelloWorld* project you created earlier.
+
. Click *Project > Build Project*, or click the build icon
image:hammer-icon.png[build icon] on the toolbar.
+
+
If you see an error message, such as:
+
`(Cannot run program "make": Launching failed)`
+
then CDT cannot locate the build command, usually `make`. Either your
path is not configured correctly, or you do not have `make` installed on
your system.
+
. You can see in the *Console* view the output and results of the build
command. Click on its tab to bring the view forward if it is not
currently visible. If for some reason it's not present, you can open it
by selecting *Window > Show View > Console*.
+
image:cdt_w_newmake03.png[Console view in C/{cpp}
Perspective,width=842,height=633]
image:ngconcepts.gif[Related concepts,width=143,height=21]
* xref:../concepts/cdt_c_projects.adoc[CDT Projects]
* xref:../concepts/cdt_c_build_over.adoc[Build overview]
image:ngtasks.gif[Related tasks,width=143,height=21]
* xref:../tasks/cdt_o_build_task.adoc[Building projects]
image:ngref.gif[Related reference,width=143,height=21]
* xref:../reference/cdt_u_newproj_buildset.adoc[Make Builder page&#44;
C/{cpp} Properties window]
xref:cdt_w_debug.adoc[image:ngnext.gif[Next
icon,width=16,height=16]] *xref:cdt_w_debug.adoc[Next: Debugging a
project]*
xref:cdt_w_newmake.adoc[image:ngback.gif[Previous
icon,width=16,height=16]] *xref:cdt_w_newmake.adoc[Back: Creating a
makefile]*

View file

@ -0,0 +1,147 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Debugging a project
The debugger lets you control the execution of your program by setting
breakpoints, suspending executed programs, stepping through your code,
and examining the contents of variables.
=== To debug a project:
. Click the *Run > Debug Configurations...* menu option.
+
The *Debug* *Configurations* dialog opens.
+
image:cdt_w_debug_configurations_01.png[Debug Configurations
dialog,width=873,height=662]
+
. Double-click *C/{cpp} Application* to create a new launch
configuration.
+
image:cdt_w_debug_configurations_02.png[C/{cpp} Application
debug configuration,width=763,height=601]
+
+
If a project is selected in the
xref:../reference/cdt_u_project_explorer_view.adoc[Project Explorer] view
the following data is automatically entered, take a moment to verify its
accuracy or change as needed.
+
[loweralpha]
.. In the *Name* edit box, type the project name, like *Hello World*.
+
You can now select this debug launch configuration by name the next time
that you debug this project.
+
.. In the *C/{cpp} Application* edit box, type the name of the executable
if its not already entered.
+
If not, click the *Search Project* button to locate the executable in
the project.
+
.. In the *Project* edit box, type or choose your project, e.g.
*HelloWorld*.
+
*NOTE* If you see the error "[.typewriter]#[Debugger]: No debugger
available#", select the *Debugger* tab and choose a valid debugger for
your platform (e.g. [.typewriter]#gdb/mi#).
+
. Click *Debug*.
+
You may be prompted to switch to the *Debug* perspective. Click *Yes*
+
The *Debug* perspective appears with the [.typewriter]#helloworld.exe#
application window open. The C/{cpp} editor repositions in the
perspective.
+
*NOTE:* If you see the error "[.typewriter]#Can't find source
file#" in the editor view, use the *Locate File* button to locate your
source file.
+
. In the left margin of the [.typewriter]#main.cpp# window, double-click
to set a breakpoint on: [.typewriter]#cout {lt}{lt} "You just entered"#
+
You'll see a blue circle
(image:icon_breakpoint_obj.gif[Breakpoint,width=16,height=16])
there indicating the breakpoint is set.
+
. Click *Run > Resume*.
+
Or, you can use the *Resume* button
(image:icon_db_resume.png[Resume,width=19,height=14]) on the
toolbar of the *Debug* view .
+
. When prompted, in the *Console* view, type a value other than 'm', and
press Enter.
+
The breakpoint will be hit.
+
. In the *Variables* view, verify that the variable is not 'm'.
+
. Click *Run > Resume*.
+
. When prompted, again type a value other than 'm' in the
xref:../reference/cdt_u_console_view.adoc[Console] view, and press Enter.
+
The breakpoint will be hit.
. In the *Variables* view, verify that the variable is not 'm'.
+
. In the *Variables* view, right-click the input variable, and select
*Change Value...* and type *'m'* _between the single quotes_ and hit
*OK*.
+
. Click *Run > Resume*.
+
The output in the [.typewriter]#helloworld.exe# application window is:
"[.typewriter]#Thank you. Exiting.#"
. The application terminates and the debug session ends. The *Debug*
perspective remains open.
To learn more about debugging, see the related debug conceptual topics.
xref:cdt_w_build.adoc[image:ngback.gif[Back
icon,width=16,height=16]] *xref:cdt_w_build.adoc[Back: Building a
project]*
image:ngconcepts.gif[Related concepts,width=143,height=21]
* xref:../concepts/cdt_c_over_dbg.adoc[Debug overview]
* xref:../concepts/cdt_c_dbg_info.adoc[Debug information]
image:ngtasks.gif[Related tasks,width=143,height=21]
* xref:../tasks/cdt_o_debug.adoc[Debugging]
image:ngref.gif[Related reference,width=143,height=21]
* xref:../reference/cdt_u_dbg_view.adoc[Debug view]
* xref:../reference/cdt_u_dbg_view.adoc[Debug launch controls]

View file

@ -0,0 +1,180 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Importing your C/{cpp} source files into Eclipse
Using the CVS Repository Exploring perspective, you can check out
modules or directories into existing projects, or create new projects. A
common scenario that you may encounter when starting to use the CDT, is
determining how to bring existing C/{cpp} source files into Eclipse. There
are a number of ways to do this. The scenarios described below are
recommended approaches.
=== Creating a project from source files in CVS
If your existing source tree is managed in CVS, you can use the CVS
Repository perspective to "Checkout As..." any folder in the repository.
The first time you "Checkout As...", the New Project wizard launches and
you need to create a C or {cpp} project for the folder. For more
information, see xref:../tasks/cdt_t_proj_new.adoc[Creating a project],
xref:../tasks/cdt_t_proj_new_with_template.adoc[Creating a project via a
project template] and xref:../tasks/cdt_o_proj_files.adoc[Working with
C/{cpp} project files].
After you perform a checkout operation, a CVS checkout of the project
occurs into the project's location. It is recommended that you
eventually add and commit the CDT project files back into CVS. These
files include .project, .cdtproject, and .cdtbuild (for Managed Build
projects) and are located at the root folder of each CDT project.
Bringing code into the IDE from CVS differs slightly, depending on what
you're importing:
* an existing C/{cpp} project
* existing C/{cpp} code that isn't part of a project
* existing C/{cpp} code that needs to be added to an existing project
==== Importing a C/{cpp} project from CVS
To check out an existing C/{cpp} project from the CVS repository into your
workspace, right-click the project in the CVS Repositories view, and
select *Check Out* from the menu. A project with the same name as the
CVS module is checked out in to your workspace.
==== Importing C/{cpp} code from CVS
To check out existing C/{cpp} code that is not part of a project:
. Right-click the module or directory in the CVS Repositories view and
choose *Check Out As...* from the menu.
+
The Check Out As wizard displays.
. Choose how to check out this project:
* as a project configured using the New Project wizard
+
or:
* as a new project in the workspace
+
or:
* as a Standard Make C/{cpp} Project - if you need to create your own
Makefile to integrate with an existing build process
+
Choose the workspace location for this project, then the CVS tag to
check out.
. Click *Finish* to exit the *Check Out As* dialog.
. Click *Next* to continue.
==== Importing C/{cpp} code into an existing project
To import a directory full of C/{cpp} code into an existing project:
. Right-click the module or directory in the CVS Repositories view and
choose *Check Out As* from the menu.
+
The IDE displays the Check Out As dialog.
. Choose *Check out into an existing project*, and then click *Next*.
The IDE displays the Check Out Into dialog:
. Select an existing project from the list, and then click *Finish* to
add the code from CVS to the selected project.
=== Creating new projects from existing source roots
If your resource code is not managed in CVS but is available from the
file system, then you need to perform two steps:
. Identify a "root folder" of your source code tree.
. Create a new C/{cpp} project using the New Project Wizard, and specify
the "root folder" as a non-default location of the new project.
Typically, existing projects will have their own makefiles, so you
should create a new Make C/{cpp} project. For more information see
xref:../tasks/cdt_t_proj_new.adoc[Creating a project] and
xref:../tasks/cdt_o_proj_files.adoc[Working with C/{cpp} project files].
To help you to identify a root folder for your project, consider the
following guidelines:
* all source code for the project is available on or beneath the root
folder
* the build results are also produced in or beneath the root folder
* there is often a makefile in the root folder. In complex projects, the
makefile in the root folder calls other makefiles in other directories
to produce the build results.
* external header files and library files do not need to be in or
beneath the root folder.
The resources for the project are maintained in the remote location
specified, not in the workspace folder for Eclipse. However, your
existing folder structure is displayed in the C/{cpp} Projects view. Meta
data for the project, such as the index for the project and the link to
the existing source, is stored in the metadata directory in the
workspace folder. For more information on the workspace folder, see
*Workbench User Guide > Tasks > Upgrading Eclipse*.
After you create a CDT project, you cannot easily move it or redefine
its root folders. If you need to, you can delete the CDT project
(without deleting its contents) and then recreate it specifying a
different non-default location.
=== Import your C/{cpp} source file system
Another approach would be to create a C/{cpp} Project and then import your
existing file system. For more information about importing, see
*Workbench User Guide > Tasks > Importing > Importing resources from the
file system*.
This approach copies the files from your file system to an Eclipse
Workbench project or folder. Your original source files remain unchanged
and it is the copies of the files that will be edited, built and
debugged using the CDT. When you have successfully imported your
existing file system, the folder structure is displayed in the C/{cpp}
Projects view. Again, you should identify an appropriate "root folder"
to import from.
==== Tip:
* Importing your existing file system can consume significant disk space
depending on the size of your files.
* Your files may become detached from an existing source control system
that previously referenced the original file location such as a
ClearCase view.
image:ngconcepts.gif[Related concepts,width=143,height=21]
* xref:../concepts/cdt_c_over_cdt.adoc[Overview of the CDT]
* xref:../concepts/cdt_c_projects.adoc[CDT Projects]
image:ngtasks.gif[Related tasks,width=143,height=21]
* xref:../tasks/cdt_o_proj_files.adoc[Working with C/{cpp} project files]
image:ngref.gif[Related reference,width=143,height=21]
* xref:../reference/cdt_o_proj_prop_pages.adoc[Project properties]

View file

@ -0,0 +1,171 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Tutorial: Importing an existing project
The following tutorial takes you though the process of importing a
'legacy' application using the CDT.
Step 1: You want to create a single project that will reflect all of the
components for the existing source tree.
. Select *File > New > Project*.
. For this tutorial, expand *C/{cpp}* and select *{cpp} project*.
+
The *New Project* wizard displays. +
image:cdt_w_import02.png[]
+
. In the *Project name* field, type a name for the project.
. Ensure that the *Use default location* option is not selected because
here we will specify where the resources reside in the file system, in a
location other than your workspace.
We assume this directory location already exists, and contains e.g.
source files and makefile. If it does not exist, it will be created.
+
In this example, we will use an existing `hello.cpp` and its existing
`hello.mak` makefile, located in the directory `c:\brandon`. +
image:cdt_w_importBrandon01.png[]
. In the *Location* field, specify the path to the existing files for
your project.
. From the *Project types* list, expand *Makefile Project* and select
*Empty Project.*.
* To have sample source and a makefile created in your existing
directory, select *Hello World {cpp} Project*
. Make sure a toolchain is selected.
. Click *Next*.
+
. (Optional) On the *Select Configurations* page, select only the
configurations you want created. Configurations display for each
toolchain selected on the previous page of the wizard.
. Click *Finish* to close the dialog box.
+
You will see the new project in the Project Explorer view. In addition,
new 'dot' files have been created in your legacy project's root
directory, these are CDT project files.
+
* (Optional) To see these "hidden" files, open the view menu on the
Project explorer view, and select "Customize View."
The view menu is activated via the small downward-pointing triangle in
the upper right of the toolbar of the view. +
image:cdt_w_viewMenu.png[]
+
* In the *Available Customizations* window, on the *Filters* tab,
uncheck ".* resources." +
image:cdt_w_viewMenuFilters.png[]
+
* The formerly hidden 'dot' files are now shown in the *Project
Explorer*. +
image:cdt_w_viewMenuFilters2.png[]
+
* Hit *OK* to close the dialog.
Step 2: You are now ready to build your project.
. To build your project, select *Project* > *Build Project*.
You can also hit the hammer icon image:hammer-icon.png[build
icon] on the toolbar to build the selected project.
. You may see an error e.g. ++make: *** no rule to make target 'all'.++
+
This is because, in our case, we didn't tell it where the makefile is,
or its name.
+
* Open the project properties (right mouse on project name in the
*Project Explorer* view and select *Properties* at the bottom on the
context menu).
* On the C/{cpp} Build Page, on its *Builder Settings* tab, uncheck ''Use
default build command'' and change the `make` command to
`make -f hello.mak` since our makefile is not named the default
`makefile`. +
image:cdt_w_importBrandon02.png[]
+
* Click *OK* to close the *Project Properties* window.
* Your project will probably rebuild. If not you can force a build via
*Project* > *Build Project* or use the hammer icon
image:hammer-icon.png[build icon].
+
After the project build completes, the results display in the *Console*
view and new objects, such as binaries and includes, show in the
*Project Explorer* view. +
image:cdt_w_importBrandon03.png[]
+
. Review the results to ensure that there are no errors.
+
+
*Note:* By default, the indexer is set to *Fast indexer* for the project
to parse your project in the same way that a compiler does; beginning
with each compilation unit and parsing that file and all files that it
includes, except that it parses each header file included in a project
only once. This method provides the most accurate index information. For
large projects using complex {cpp} code, this indexer can be slow. For
example, if a header file is included and takes two compilation units,
the parsing of the second unit reuses the results of parsing the first
unit. This is similar to how precompiled headers work. The indexing of
large projects using the Fast indexer uses fewer resources than the Full
indexer, but the resulting index is not quite as accurate.
To change indexer settings, bring up the Indexer page in the Project
Properties. +
image:cdt_w_indexer.png[]
+
Step 3: You are now ready to run your application.
. To run your application within the C/{cpp} Perspective, click *Run > Run
Configurations...*
+
The *Run Configurations* dialog displays.
. To create a run configuration, select *C/{cpp} Application* and click
the *New* icon.
. Give your run configuration a name by entering a new name in the
*Name* field at the top.
. On the *Main* tab, select the project by clicking *Browse* opposite
the *Project* field.
* From the Project Selection window, select the project and click *OK*.
. Select the new *C/{cpp} Application* you want to execute by clicking
*Search*.
+
In our case it didn't find the file because it's in a nonstandard
location. Use the *Browse* button to select the executable. In our case
also it's a nonstandard name, `hello.e` because that's what our makefile
`hello.mak` built. +
image:cdt_w_importBrandon04run.png[]
+
* If you see the error `[Debugger]: No debugger available`, select the
Debugger tab and choose a valid debugger for your platform (e.g.
gdb/mi).
. Click *Run* to save the run configuration and run it. +
image:cdt_w_importBrandon04run2.png[]
+
The application runs in the *Console* view. The *Console* also shows
which application it is currently running in the title bar. You can
configure the view to display different elements, such as user input
elements using different colors.

View file

@ -0,0 +1,112 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Installing and updating the CDT
You can use the Software Updates manager to quickly install or update
the CDT directly from the Eclipse workbench using your internet
connection.
To obtain the latest CDT features:
. Select *Help > Software Updates > Find and Install*.
+
image:cdt_update_find-install.png[]
+
. In the *Feature Updates* window, select *Search for new features to
install* and click *Next*.
+
Note: If you want to search for updates on features that you currently
have installed, you can select the option *Search for updates of the
currently installed features*, and then follow the steps to update using
that method.
+
image:cdt_update_install_new.png[]
+
. If you have not updated previously, you will have to enter the
location of the Eclipse CDT Install site. Click *New Remote Site...*.
+
image:cdt_update_install_sites.png[]
+
. In the New Update Site dialog box, type the name and URL for the
Eclipse update site.
+
image:cdt_update_install_new_sites.png[]
+
. Click *OK*.
+
. From the *Sites to include in search* list, select the update site you
just created by clicking the appropriate check box, and click *Finish*.
+
image:cdt_update_install_cdt_site.png[]
+
. The Search Results dialog shows the features available to install from
the update site. Expand and select any additional features that you
require. De-select any options that do not apply to you.
+
. Click *Next*.
+
image:cdt_update_search_results.png[]
+
. You must accept the Eclipse.org Software User Agreement to continue
installing the CDT update. If you accept the terms, select *I accept the
terms in the license agreement* and then click *Next*.
+
image:cdt_update_license_agreement.png[]
+
+
You can review the summary list of the features you selected to
install.
+
. Optional: Click *Change Location* to select the location you would
like the updates installed. Typically, this is the directory where you
installed Eclipse.
+
. Click *Finish*.
+
image:cdt_update_location.png[]
+
. You will now start downloading the CDT components. You will have to
verify that you want the features installed by clicking *Install* for
each feature you selected.
+
image:cdt_update_jar_verification.png[]
+
+
Now, you have to restart Eclipse.
+
. Select *Yes* to complete the feature installation process.
+
image:cdt_restart.png[]
image:ngconcepts.gif[Related concepts,width=143,height=21]
* xref:../concepts/cdt_c_over_cdt.adoc[CDT Overview]
* xref:../concepts/cdt_c_perspectives.adoc[C/{cpp} Development perspective]

View file

@ -0,0 +1,108 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Creating your {cpp} file
You can begin coding your HelloWorld program. The .cpp file that you
create will be saved in the project folder you just created
xref:cdt_w_newproj.adoc[Creating a Makefile project].
Files are edited in the C/{cpp} editor located to the right of the C/{cpp}
Projects view. The left margin of the C/{cpp} editor, called the marker
bar, displays icons for items such as bookmarks, breakpoints, and
compiler errors and warnings.
For more information about:
* The editor area and marker bar, see *Workbench User Guide > Reference
> User interface information > Views and editors > Editor area*
* The marker bar icons, see *Workbench User Guide > Reference > User
interface information > Icons and buttons > Editor area marker bar*
To create a {cpp} file:
. In the *Project Explorer* view, right-click the *HelloWorld* project
folder, and select *New > Source File*.
. In the *Source file:* field, type *main.cpp*.
By default the source folder should be your project folder.
The template selected is probably ``Default C/{cpp} Source Template.''
. Click *Finish*.
. A Comment template probably appears at the top of an otherwise empty
file. Type the code, exactly as it appears below, in the editor. Or you
can paste it in from this help file.
+
....
#include <iostream>
using namespace std;
int main () {
// Say HelloWorld five times
for (int index = 0; index < 5; ++index)
cout << "HelloWorld!" << endl;
char input = 'i';
cout << "To exit, press 'm' then the 'Enter' key." << endl;
cin >> input;
while(input != 'm') {
cout << "You just entered '" << input << "'. "
<< "You need to enter 'm' to exit." << endl;
cin >> input;
}
cout << "Thank you. Exiting." << endl;
return 0;
}
....
. Click *File > Save*.
Your new .cpp file is displayed in the *Project Explorer* view. Your
project now contains main.cpp. Before you can build your HelloWorld
project, you must create a makefile.
xref:cdt_w_newmake.adoc[image:ngnext.gif[Next
icon,width=16,height=16]] *xref:cdt_w_newmake.adoc[Next: Creating your
makefile]*
xref:cdt_w_newproj.adoc[image:ngback.gif[Back
icon,width=16,height=16]] *xref:cdt_w_newproj.adoc[Back: Creating your
project]*
image:ngconcepts.gif[Related concepts,width=143,height=21]
* xref:../concepts/cdt_c_projects.adoc[CDT projects]
* xref:../concepts/cdt_c_proj_file_views.adoc[Project file views]
* xref:../concepts/cdt_o_code_entry.adoc[Coding aids]
image:ngtasks.gif[Related tasks,width=143,height=21]
* xref:../tasks/cdt_o_proj_files.adoc[Working with C/{cpp} project files]
* xref:../tasks/cdt_o_write_code.adoc[Writing code]
image:ngref.gif[Related reference,width=143,height=21]
* xref:../reference/cdt_o_proj_prop_pages.adoc[C/{cpp} Projects view]

View file

@ -0,0 +1,87 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Creating a makefile
For the purpose of this tutorial, you were instructed to create a {cpp}
Project which requires you to create a makefile.
To create a makefile:
. In the *Project Explorer* view, right-click the *HelloWorld* project
folder and select *New > File*.
. In the *File name* box, type *makefile*.
. Click *Finish*.
. Type the gnu make instructions below in the editor. Lines are indented
with tab characters, not with spaces.
+
[source,makefile]
----
all: hello.exe
# NOTE: ensure the indented lines are indented with tab characters and not space.
clean:
rm main.o hello.exe
hello.exe: main.o
g++ -g -o hello main.o
main.o:
g++ -c -g main.cpp
----
. Click *File > Save*.
Your new makefile, along with your main.cpp file are displayed in the
Project Explorer view. Your project now contains main.cpp and makefile.
You can now build your HelloWorld project.
image:cdt_w_newmake02.png[]
xref:cdt_w_build.adoc[image:ngnext.gif[Next
icon,width=16,height=16]] *xref:cdt_w_build.adoc[Next: Building your
project]*
xref:cdt_w_newcpp.adoc[image:ngback.gif[Back
icon,width=16,height=16]] *xref:cdt_w_newcpp.adoc[Back: Creating your {cpp}
file]*
image:ngconcepts.gif[Related concepts,width=143,height=21]
* xref:../concepts/cdt_c_projects.adoc[Project]
* xref:../concepts/cdt_o_code_entry.adoc[Code entry]
image:ngtasks.gif[Related tasks,width=143,height=21]
* xref:../tasks/cdt_o_proj_files.adoc[Working with C/{cpp} project files]
* xref:../tasks/cdt_o_write_code.adoc[Writing code]
image:ngref.gif[Related reference,width=143,height=21]
* xref:../reference/cdt_o_proj_prop_pages.adoc[C/{cpp} Projects view]

View file

@ -0,0 +1,166 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Creating a Makefile project
This tutorial describes the process of creating a new {cpp} project that
includes a makefile, and debugging the program.
You need to create a project to contain your source code and related
files. A project has an associated builder that can incrementally
compile source files as they are changed.
To create a project:
. Select *File > New > Project*.
+
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.
+
. Select the type of project to create. For this tutorial, expand the
*C/{cpp}* folder and select *{cpp} Project*.
+
The *{cpp} Project* wizard opens. javascript:void(0)[Click here to see an
illustration.]
+
By default, the CDT filters the *Toolchain* and *Project types* that
currently display in those lists are based on the language support for
the {cpp} Project wizard you selected for this tutorial.
+
. In the *Project name* field, type HelloWorld.
. Leave the *Use Default Location* option selected.
+
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:
* *Executable* - Provides an executable application. This project type
folder contains three templates.
** *Hello World {cpp} Example* provides a simple {cpp} Hello World
application with main().
** *Hello World ANSI C Example* provides a simple C Hello World
application with main().
** *Empty Project* provides a single source project folder that contains
no files.
+
After you select this template, the result is a project with only the
meta-data files required for the project type. You are expected to
provide source files for the project's target.
+
The makefile for the *Executable* project type is automatically created
by the CDT.
+
* *Shared Library* - 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
libxx.so.`version`, where `version` is a number with a default of 1. The
libxx.so file usually is a symbolic link to the latest version. The
makefile for this project type is automatically created by the CDT.
* *Static Library* - A collection of object files that you can link into
another application (libxx.a). The CDT combines object files (i.e. *.o)
into an archive (*.a) that is directly linked into an executable. The
makefile for this project type is automatically created by the CDT.
* *Makefile Project* - 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.
+
By default, the CDT filters the *Toolchain* and *Project types* that
currently display in those lists based on the language support for the
{cpp} Project wizard you selected for this tutorial.
+
. From the *Project types* list, expand *Makefile project* and select
*Empty Project*. This project lets you enter the source file and the
makefile yourself.
. Select a required toolchain from the *Toolchain* list.
+
A toolchain is a set of tools (such as a compiler, linker, and
assembler) intended to build your project. Additional tools, such as a
debugger, can be associated with a toolchain.
There can be several toolchains available, depending on the compilers
installed on your system.
. Click *Next*.
. (Optional) On the *Select Configurations* page, Click *Advanced
Settings*.
* Expand *C/{cpp}Build > Settings*. Click the *Binary Parsers* tab.
+
javascript:void(0)[Click here to see an illustration.]
+
* In the *Binary Parser* list, select the error parser that is
appropriate for your platform. Other project settings can be modified
here as well. The default selection is probably OK.
+
To ensure the accuracy of the C/{cpp} Projects view and the ability to
successfully run and debug your programs, selecting the correct parser
is important. After you select the correct parser for your development
environment and build your project, you can view the components of the
.o file in the C/{cpp} Projects view. You can also view the contents of
the .o file in the C/{cpp} editor.
+
Click *OK* to close the Project Properties window.
. Click *Finish*.
. If a message box prompts you to change perspectives, click *Yes*.
Your new project displays in the Project Explorer view. Your project is
empty because you have not yet created files for your project. You may
see an error since there is nothing to build yet for your project. You
can now start writing the code for your HelloWorld program.
*Tip:* You can view and modify the properties of your HelloWorld project
at any time by right-clicking on the project in the *Project Explorer*
view and clicking Properties.
xref:cdt_w_newcpp.adoc[image:ngnext.gif[Next
Icon,width=16,height=16]] xref:cdt_w_newcpp.adoc[*Next: Creating your {cpp}
file*]
For more information about:
* Projects, see *Workbench User Guide > Concepts > Workbench >
Resources*
* The workspace, see *Workbench User Guide > Tasks > Upgrading Eclipse*
image:ngconcepts.gif[Related concepts,width=143,height=21]
* xref:../concepts/cdt_c_over_cdt.adoc[CDT overview]
* xref:../concepts/cdt_c_projects.adoc[CDT projects]
* xref:../concepts/cdt_c_proj_file_views.adoc[Project file views]
image:ngtasks.gif[Related tasks,width=143,height=21]
* xref:../tasks/cdt_o_proj_files.adoc[Working with C/{cpp} project files]
image:ngref.gif[Related reference,width=143,height=21]
* xref:../reference/cdt_o_proj_prop_pages.adoc[C/{cpp} Projects view]

View file

@ -0,0 +1,66 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
== Preparing the Workbench
This tutorial will get you started using the C/{cpp} Development Toolkit (CDT) in the Workbench.
First, you will verify that the workbench is properly configured for C/{cpp} development. It is assumed that:
- Your Workbench has its default settings. To reset the current perspective to its original layout, from the menu bar select **Window &gt; Reset Perspective**.
- You are familiar with the basic Workbench features, such as views xref:../concepts/cdt_c_views.adoc[views] and xref:../concepts/cdt_c_perspectives.adoc[perspectives]
== Setting the global editor operations and appearance
The main place to configure global editor-related preferences is the image:command_link.png[] xref:javascript:executeCommand('org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Editors)')[General &gt; Editors] preference pages (also accessible through the **Window &gt; Preferences** menu item)
== Setting the C/{cpp} editor operations and appearance
C/{cpp}-specific editor preferences are under image:command_link.png[] xref:javascript:executeCommand('org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Editors)')[C/{cpp} &gt; Editor].
They include the following:
- xref:../reference/cdt_u_c_editor_gen.adoc[Editor] - control the appearance of text highlighting
- xref:../reference/cdt_u_c_editor_con_assist.adoc[Content Assist] - customize the Content Assist feature
- xref:../reference/cdt_u_c_editor_folding.adoc[Folding] - customize folding behavior
- xref:../reference/cdt_u_c_editor_hov.adoc[Hovering] customize hover behavior
- xref:../reference/cdt_u_c_editor_mark_occurrences.adoc[Mark Occurrences] - set annotations
- xref:../reference/cdt_u_c_editor_save_actions.adoc[Save Actions] - configure actions performed while saving a file
- xref:../reference/cdt_u_c_editor_scalability.adoc[Scalability] - configure behavior for handling large source files
- xref:../reference/cdt_u_c_editor_color.adoc[Syntax Coloring] - specify how C/{cpp} source code is rendered
- xref:../reference/cdt_u_c_code_templates_pref.adoc[Templates] - configure the format of newly generated code stubs, comments and files
- xref:../reference/cdt_u_c_editor_typing.adoc[Typing] - configure formatting input as you type
image:ngref.gif["Related reference"]
- xref:../reference/cdt_o_ceditor_pref.adoc[C/{cpp} Editor Preferences]

View file

@ -0,0 +1,2 @@
<hr>
<p><small>Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation</small></p>

View file

@ -0,0 +1 @@
<script type="text/javascript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"></script>

View file

@ -0,0 +1,48 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
Copy the code below and paste it into the *main.cpp* file in the Editor
view:
....
#include <iostream>
#include <string>
using namespace std;
int main()
{
string yourName;
cout << "Type your name: ";
cin >> yourName;
cout << "Hello " + yourName << endl;
return 0;
}
....

View file

@ -0,0 +1,44 @@
////
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
:toc:
:toc-placement!:
endif::[]
// enable support for button, menu and keyboard macros
:experimental:
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
Copy the script below and paste it into the *makefile* file in the
Editor view:
....
all: hello
clean:
-rm main.o hello.exe hello
hello: main.o
g++ -g -o hello main.o
main.o: main.cpp
g++ -c -g main.cpp
....

View file

@ -1,17 +1,16 @@
////
Copyright (c) 2000-2024 QNX Software Systems and others
Copyright (c) 2000, 2025 Contributors to the Eclipse Foundation
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
QNX Software Systems - original makefile project content
John Dallaway - initial CMake project content (#935)
////
// pull in shared headers, footers, etc
:docinfo: shared
// support image rendering and table of contents within GitHub
ifdef::env-github[]
:imagesdir: ../../images
@ -22,9 +21,16 @@ endif::[]
// enable support for button, menu and keyboard macros
:experimental:
= Creating a CMake project
// Until ENDOFHEADER the content must match adoc-headers.txt for consistency,
// this is checked by the build in do_generate_asciidoc.sh, which also ensures
// that the checked in html is up to date.
// do_generate_asciidoc.sh can also be used to apply this header to all the
// adoc files.
// ENDOFHEADER
This tutorial describes the process of creating a new C/C++ project that includes a CMakeLists.txt file.
== Creating a CMake project
This tutorial describes the process of creating a new C/{cpp} project that includes a CMakeLists.txt file.
You need to create a project to contain your source code and related files.
A project has an associated builder that can incrementally compile source files as they are changed.
@ -33,26 +39,26 @@ To create a project:
. Select menu:File[New > Project].
+
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.
. Select the type of project to create. For this tutorial, expand the *C/{cpp}* folder and select *C/C++ Project*.
. Select the type of project to create. For this tutorial, expand the *C/{cpp}* folder and select *C/{cpp} Project*.
. Click btn:[Next].
+
The *C/C++ Project* wizard opens:
+
The *C/{cpp} Project* wizard opens:
image:c_cpp_project_wizard.png[width=515]
+
By default, the CDT presents all *C/C++ Project* templates.
By default, the CDT presents all *C/{cpp} Project* templates.
. Select the *CMake* template filter and choose from the following *CMake* project templates:
+
- *CMake Project* - provides a simple C++ Hello World executable application project with main() and a supporting CMakeLists.txt file.
- *CMake Project* - provides a simple {cpp} Hello World executable application project with main() and a supporting CMakeLists.txt file.
- *Empty or Existing CMake Project* - provides an empty executable application project suitable for importing existing source and CMakeLists.txt files.
. Click btn:[Next].
@ -65,4 +71,4 @@ Your new project displays in the Project Explorer view.
Your project may be empty because you have not yet created files for your project.
You can now start writing the code for your application or importing code from elsewhere.
icon:arrow-circle-right[] link:pass:[../getting_started/cdt_w_newcpp.htm][Next: Creating your C++ file]
icon:arrow-circle-right[] xref:cdt_w_newcpp.adoc[Next: Creating your {cpp} file]

View file

@ -4,7 +4,7 @@
<topic label="Preparing the Workbench" href="getting_started/cdt_w_prepare_workbench.htm"/>
<topic label="Creating a simple application" href="getting_started/cdt_w_basic.htm"/>
<topic label="Creating a Makefile project" href="getting_started/cdt_w_newproj.htm"/>
<topic label="Creating a CMake project" href="html/new_cmake_proj.html"/>
<topic label="Creating a CMake project" href="getting_started/new_cmake_proj.htm"/>
<topic label="Importing an existing project" href="getting_started/cdt_w_import.htm"/>
<topic href="getting_started/cdt_w_newcpp.htm" label="Creating a C++ file"/>
<topic href="getting_started/cdt_w_newmake.htm" label="Creating a makefile"/>

View file

@ -1066,6 +1066,11 @@
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>3.1.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>

View file

@ -21,3 +21,4 @@ ${DIR}/do_add_all_file_types_to_gitattributes.sh
${DIR}/do_project_settings.sh
${DIR}/do_rebuild_natives.sh
${DIR}/do_fix_file_permissions.sh
${DIR}/do_generate_asciidoc.sh

View file

@ -0,0 +1,39 @@
#!/bin/bash
###############################################################################
# Copyright (c) 2025 Kichwa Coders Canada Inc
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
###############################################################################
set -e
SCRIPT=$( basename "${BASH_SOURCE[0]}" )
##
# Make sure that asciidocs are up to date
##
for p in doc/org.eclipse.cdt.doc.user; do
echo "Rebuilding $p asciidocs to make sure they match source"
echo "Ensure adoc files start with expected contents"
ref_header=$p/adoc-headers.txt
git ls-files -- $p/**/*.adoc | while read i ; do
end_line=$(awk '/\/\/ ENDOFHEADER/{ print NR + 1; exit }' $i)
tmpfile=$(mktemp /tmp/adoc.XXXXXX)
cat $ref_header > $tmpfile
tail --lines=+${end_line:=0} $i >> $tmpfile
mv -f $tmpfile $i
done
echo "Generate html from adoc files"
logfile=asciidoc-${p//\//-}.log
if ! ${MVN:-mvn} -B -V generate-resources -DuseSimrelRepo -f $p >${logfile} 2>&1; then
echo "Rebuilding of $p asciidocs failed. The log (${logfile}) is part of the artifacts of the build"
exit 1
fi
done