|
@@ -189,51 +189,51 @@ Use the terminal and the command `mkdir` to create a directory `Documents/eip` f
|
189
|
189
|
|
190
|
190
|
#### Instructions
|
191
|
191
|
|
192
|
|
-1) To start a C++ project, press the `New Project` button or go to the Qt main menu and in `File` select `New File or Project`. A window similar to the one in Figure 2 will appear. Select `Non-Qt Project`, `Plain C++ Project` and press `Choose`.
|
|
192
|
+1. To start a C++ project, press the `New Project` button or go to the Qt main menu and in `File` select `New File or Project`. A window similar to the one in Figure 2 will appear. Select `Non-Qt Project`, `Plain C++ Project` and press `Choose`.
|
193
|
193
|
|
194
|
|
- ---
|
|
194
|
+ ---
|
195
|
195
|
|
196
|
|
- ![figure2.png](images/figure2.png)
|
|
196
|
+ ![figure2.png](images/figure2.png)
|
197
|
197
|
|
198
|
|
- **Figure 2.** Start C++ project without graphical applications.
|
|
198
|
+ **Figure 2.** Start C++ project without graphical applications.
|
199
|
199
|
|
200
|
|
- ---
|
201
|
|
-
|
202
|
|
-
|
203
|
|
-2) Write the name of the project, select the directory where you would like to save it, press `Next` in that window and the following one, and then `Finish` in the next one.
|
|
200
|
+ ---
|
204
|
201
|
|
|
202
|
+2. Write the name of the project, select the directory where you would like to save it, press `Next` in that window and the following one, and then `Finish` in the next one.
|
|
203
|
+
|
205
|
204
|
This process will create a new Qt project with the skeleton for a basic C++ program that only displays "Hello World!". Before continuing, select `Projects` in the vertical menu to the left. A window called `Build Settings` should appear. In this window, make sure the `Shadow build` checkbox is NOT selected, as shown in Figure 3.
|
206
|
205
|
|
207
|
|
- ---
|
|
206
|
+ ---
|
208
|
207
|
|
209
|
|
- ![figure3.png](images/figure3.png)
|
|
208
|
+ ![figure3.png](images/figure3.png)
|
210
|
209
|
|
211
|
|
- **Figure 3.** The `Shadow build` option is not selected.
|
|
210
|
+ **Figure 3.** The `Shadow build` option is not selected.
|
212
|
211
|
|
213
|
|
- ---
|
214
|
|
-
|
|
212
|
+ ---
|
215
|
213
|
|
216
|
|
-3) Return to the window where you can edit the program by selecting `Edit` in the left menu and double clicking `Sources` and then `main.cpp`. Press the green arrow on the left menu to execute the program. The results for the program will be displayed in the terminal window. If there were any errors, these would appear in the `Issues` window in Qt.
|
|
214
|
+3. Return to the window where you can edit the program by selecting `Edit` in the left menu and double clicking `Sources` and then `main.cpp`. Press the green arrow on the left menu to execute the program. The results for the program will be displayed in the terminal window. If there were any errors, these would appear in the `Issues` window in Qt.
|
217
|
215
|
|
218
|
|
-4) Change the contents of `main.cpp` as such:
|
|
216
|
+4. Change the contents of `main.cpp` to the following:
|
219
|
217
|
|
220
|
|
- ```cpp
|
221
|
|
- #include <iostream>
|
222
|
|
- using namespace std;
|
|
218
|
+ ```cpp
|
|
219
|
+ #include <iostream>
|
|
220
|
+ using namespace std;
|
|
221
|
+
|
|
222
|
+ int main()
|
|
223
|
+ {
|
|
224
|
+ cout << endl << "I like the programming laboratory." << endl;
|
|
225
|
+ return 0;
|
|
226
|
+ }
|
223
|
227
|
|
224
|
|
- int main()
|
225
|
|
- {
|
226
|
|
- cout << endl << "I like the programming laboratory." << endl;
|
227
|
|
- return 0;
|
228
|
|
- }
|
229
|
|
- ```
|
|
228
|
+ ```
|
|
229
|
+ ---
|
230
|
230
|
|
231
|
|
-5) Press the green button in the left menu to compile and execute the program. A window will appear that offers the option to store the changes. Press `Save all`. When executed, if you did not commit any errors, the program will display "I like the programming laboratory." in the terminal window.
|
|
231
|
+1. Press the green button in the left menu to compile and execute the program. A window will appear that offers the option to store the changes. Press `Save all`. When executed, if you did not commit any errors, the program will display "I like the programming laboratory." in the terminal window.
|
232
|
232
|
|
233
|
233
|
|
234
|
234
|
### Exercise 2: Download projects from Bitbucket
|
235
|
235
|
|
236
|
|
-The files for this laboratory experience are stored in Bitbucket. In each laboratory session, you will download the Bitbucket folder that contains the files for that laboratory experience and you will save them in the `Documents/eip` directory you created in Exercise 0. To download the corresponding folder for this laboratory experience, open the terminal, use the Linux commands to move to the `Documents/eip` directory and write the command `git clone https://bitbucket.org/eip-uprrp/intro-introduccion.git`. Go to the `Documents/eip` directory and verify that it contains the `intro-introduction` folder.
|
|
236
|
+The files for this laboratory experience are stored in Bitbucket. In each laboratory session, you will download the Bitbucket folder that contains the files for that laboratory experience and you will save them in the `Documents/eip` directory you created in Exercise 0. To download the corresponding folder for this laboratory experience, open the terminal, use the Linux commands to move to the `Documents/eip` directory and write the command `git clone https://bitbucket.org/eip-uprrp/intro-introduction.git`. Go to the `Documents/eip` directory and verify that it contains the `intro-introduction` folder.
|
237
|
237
|
|
238
|
238
|
|
239
|
239
|
### Exercise 3: Open project already created, compile and run
|
|
@@ -243,19 +243,19 @@ In this exercise you will practice how to compile, fix errors, and execute a pro
|
243
|
243
|
|
244
|
244
|
#### Instructions
|
245
|
245
|
|
246
|
|
-1) First delete the files created by Qt and close the files from the previous project. To do this, in the Qt main menu go to `Build` and select `Clean all`; then go to `File` and select `Close all projects and editors`.
|
|
246
|
+1. First delete the files created by Qt and close the files from the previous project. To do this, in the Qt main menu go to `Build` and select `Clean all`; then go to `File` and select `Close all projects and editors`.
|
247
|
247
|
|
248
|
|
-2) Load the `QtCreator` project called `Practice` by double clicking the file `Practice.pro` in the `Documents/eip/introduction` directory on your computer. In the window that appears, press `Configure Project`.
|
|
248
|
+2. Load the `QtCreator` project called `Practice` by double clicking the file `Practice.pro` in the `Documents/eip/introduction` directory on your computer. In the window that appears, press `Configure Project`.
|
249
|
249
|
|
250
|
250
|
Each time you load or start a new project, make sure that `Shadow build` is not selected: in the menu to the left, select `Projects`, then in `Build Settings` verify that the checkbox for `Shadow build` is not selected, as we saw in Figure 3.
|
251
|
251
|
|
252
|
|
-3) As you saw previously, Qt allows you to compile and execute a program by pressing the green arrow that appears in the left column. Press the arrow and notice that you obtain a window of "Issues" that occurred when compiling. The list that appears will show you information that allows you to find and fix the errors.
|
|
252
|
+3. As you saw previously, Qt allows you to compile and execute a program by pressing the green arrow that appears in the left column. Press the arrow and notice that you obtain a window of "Issues" that occurred when compiling. The list that appears will show you information that allows you to find and fix the errors.
|
253
|
253
|
|
254
|
|
-4) Select the `main.cpp` file in the `Sources` directory so you can find and fix the errors.
|
|
254
|
+4. Select the `main.cpp` file in the `Sources` directory so you can find and fix the errors.
|
255
|
255
|
|
256
|
256
|
Fix all of the errors and press the green arrow once again to compile and execute the program. Once you fix the errors, the program should open a window `Application Output` and display `Exit: 1`.
|
257
|
257
|
|
258
|
|
-5) As mentioned earlier, during the compilation and execution process, Qt creates various files we should delete after terminating the program. To do this, in the `Build` option of the Qt menu, select `Clean All`.
|
|
258
|
+5. As mentioned earlier, during the compilation and execution process, Qt creates various files we should delete after terminating the program. To do this, in the `Build` option of the Qt menu, select `Clean All`.
|
259
|
259
|
|
260
|
260
|
|
261
|
261
|
### Exercise 4: Deliverables
|
|
@@ -265,4 +265,4 @@ During each laboratory experience, each pair will hand in some of the results of
|
265
|
265
|
|
266
|
266
|
#### Instructions
|
267
|
267
|
|
268
|
|
-1) Open the "Deliverables" link on Moodle and hand in the `main.cpp` file. Remember to use good programming techniques, including the name of the programmers as a comment at the beginning of the program.
|
|
268
|
+1. Open the "Deliverables" link on Moodle and hand in the `main.cpp` file. Remember to use good programming techniques, including the name of the programmers as a comment at the beginning of the program.
|