Lines 35-41
Link Here
|
35 |
<a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic04.png')">Click here to see an illustration.</a><br></p> |
35 |
<a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic04.png')">Click here to see an illustration.</a><br></p> |
36 |
<p><br>By default, the CDT filters the <b>Toolchain</b> and <b>Project types</b> that it displays in those lists based on the language support for the C++ Project wizard you selected for this tutorial.</p> |
36 |
<p><br>By default, the CDT filters the <b>Toolchain</b> and <b>Project types</b> that it displays in those lists based on the language support for the C++ Project wizard you selected for this tutorial.</p> |
37 |
</li><br> |
37 |
</li><br> |
38 |
<li><p>In the <b>Project name</b> field, type a name for the project.</p> |
38 |
<li><p>In the <b>Project name</b> field, type a name for the project, such as <b>Hello World</b>.</p> |
39 |
<br> |
39 |
<br> |
40 |
<li><p>From the <b>Project types</b> list, expand <b>Executable</b> and select <b>Hello World C++ Project</b>. This project type provides a simple Hello World application in C++, and the makefile is automatically created by the CDT.</p> |
40 |
<li><p>From the <b>Project types</b> list, expand <b>Executable</b> and select <b>Hello World C++ Project</b>. This project type provides a simple Hello World application in C++, and the makefile is automatically created by the CDT.</p> |
41 |
<br> |
41 |
<br> |
Lines 67-129
Link Here
|
67 |
<br> |
67 |
<br> |
68 |
<p>A project is created with the default settings and a full set of configurations based on the project type and toolchain you selected. |
68 |
<p>A project is created with the default settings and a full set of configurations based on the project type and toolchain you selected. |
69 |
You should now see the new project in C/C++ Projects view.</p> |
69 |
You should now see the new project in C/C++ Projects view.</p> |
|
|
70 |
<p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic12.png')">Click here to see an illustration.</a></p> |
71 |
<br> |
70 |
</ol> |
72 |
</ol> |
71 |
|
73 |
|
72 |
<h3>Step 2: Creating a new file for the project</h3> |
74 |
<h3>Step 2: Reviewing the code and building the project</h3> |
73 |
<p>Now, you will create a new .cpp file (such as main.cpp) that will contain some code that you will copy from another file into an editor. </p> |
|
|
74 |
|
75 |
<ol> |
76 |
<li>Right-click on your project in the Navigator. |
77 |
<li>Select <b>New > Source File</b>. |
78 |
<p>You should now see the new project in the C/C++ Projects view under the project, and the new file opens in the <b>Editor</b> view.</p> |
79 |
</ol> |
80 |
|
81 |
<h3>Step 3: Enter and step through the code</h3> |
82 |
<ol> |
75 |
<ol> |
83 |
<li>Copy the code from the file <a href="javascript:void(0)" |
76 |
<li>From the Project Explorer in the C++ Projects View, double-click the .cpp file that was created for your project, for example, <tt>Hello World.cpp</tt>. |
84 |
onclick="newWin('hw_example.htm')" title="here">main.cpp</a> |
77 |
<p>This file opens in a default editor. It contains C++ template code for the Hello World example project you selected earlier.</p> |
85 |
file that was just created. |
78 |
<br> |
86 |
<p> |
79 |
<p><b>Note:</b> You can specify a different editor, and add or modify existing code templates in <b>Window > Preferences</b>.</p><p>In addition, the <b>Outline</b> view has also been populated |
87 |
You can double click the <b>main.cpp</b> tab in the <b>Editor</b> |
80 |
with objects created from your code.</p> <p><a href="javascript:void(0)" onClick="newWin('../images/cdt_w_basic13.png')">Click here to see an illustration.</a></p> |
88 |
view to expand the view. <br> |
81 |
</li> |
89 |
<i>Note: Leave a blank line at the end of the code because it is required by some compilers.</i></p> |
82 |
<li>Optional: You can type additional code in this file, and then save the changes by clicking <span |
90 |
<p>On the tab in the <b>Editor</b> view, an asterisk character ("*") prefixes the file name. The asterisk indicates that the file has changed but has not been saved.</p> |
83 |
style="font-weight: bold;">File > Save</span>, or pressing <b>CTRL+S</b>. |
91 |
<li>Notice that the <b>Outline</b> view has also been populated |
84 |
|
92 |
with objects created from your code. </p> |
85 |
<p><br>Next, you will need to build your project before you can run it.</p><br></li> |
93 |
<p>If you select an item from the <b>Outline</b> view, the |
86 |
<li>Build your project by pressing <b>CTRL+B</b>, or select the project from the Project Explorer tab in the C++ Projects view and select <b>File > Build Project</b>.</p> |
94 |
corresponding text in the editor is highlighted. |
87 |
<p><br><b>Note:</b> If a build generates any errors or warnings, you can see those in the Problems view. If you encounter difficulty, see the topics <a href="../concepts/cdt_c_build_over.htm">Building C/C++ projects</a> and <a href="../concepts/cdt_c_before_you_begin.htm">Before you begin</a><br>.</p></li> |
95 |
<li>Save the main.cpp file by clicking <span |
88 |
<li>Read through the build messages in the <b>Console</b> view. |
96 |
style="font-weight: bold;">File > Save</span> or pressing <b>CTRL+S</b>. |
89 |
The project should build successfully.</p> |
97 |
<li>Build your project by pressing <b>CTRL+B</b>.</p> |
|
|
98 |
<p>You can read through the build messages in the <b>Console</b> view. |
99 |
The project should build successfully, showing the following message:</p> |
100 |
<p><tt>Finished building target: HelloWorld.exe</tt></p> |
101 |
<br> |
90 |
<br> |
102 |
<p>You will also see the <b>Outline</b> view has also been populated |
91 |
<p>You will also see the <b>Outline</b> view has also been populated |
103 |
with objects created from your code. </p> |
92 |
with objects created from your code. If you select an item from the <b>Outline</b> view, the |
104 |
<p>If you select an item from the <b>Outline</b> view, the |
93 |
corresponding text in the editor is highlighted.</p><br> |
105 |
corresponding text in the editor is highlighted.</p></li> |
|
|
106 |
</ol> |
94 |
</ol> |
107 |
|
95 |
|
108 |
<h3>Step 4: Running the application</h3> |
96 |
<h3>Step 3: Running the application</h3> |
|
|
97 |
|
98 |
<p>To run your application:</p> |
109 |
<ol> |
99 |
<ol> |
110 |
<li>To run your application within the C/C++ Perspective, click <b>Run > Run...</b> |
100 |
<li>Within the C/C++ Perspective, click <b>Run > Run</b>.<p><br></p></li> |
111 |
<li>Select <b>C/C++ Local Application</b>. |
101 |
<li>Select <b>C/C++ Local Application</b>.<p><br></p></li> |
112 |
<li>Click <b>'New'</b>. |
102 |
<li>Click <b>New</b>.<p><br></p></li> |
113 |
<li>Click <b>'New'</b>.</p> |
|
|
114 |
|
103 |
|
115 |
<p>A new Run Configuration is created. Its name and path to executable are provided by the project ('HelloWorld' in our case). |
104 |
<p>A new Run Configuration is created. Its name and path to the executable are provided by the project ('Hello World' in our case). |
116 |
|
105 |
|
117 |
<li>Click <b>'Run'</b>. |
106 |
<li>Click <b>Run</b>.<p><br></p> |
118 |
</ol> |
|
|
119 |
|
107 |
|
120 |
<h3>Step 5: Reviewing and interpreting the results in the Console view</h3> |
108 |
<p>Now, you should see the Hello World application running in the <b>Console</b> view. |
121 |
<p>Now, you should now see the Hello World application running in the <b>Console</b> view. |
109 |
The <b>Console</b> also shows which application is running in a title bar.</p><br></li> |
122 |
The <b>Console</b> also shows which application is running in a title bar. |
|
|
123 |
You can configure this view to display different elements (such as user input elements) using different colors.</p> |
124 |
<ol> |
125 |
<li>Type in your name and press Enter. |
126 |
<p>The title bar in the <b>Console</b> view shows you when the program has terminated.</p> |
127 |
|
110 |
|
128 |
<li>You can click the other views to see the information that they contain. |
111 |
<li>You can click the other views to see the information that they contain. |
129 |
</ol> |
112 |
</ol> |