Using codelite - Title is self explanatory PDF

Title Using codelite - Title is self explanatory
Author VybeGamingHQ
Course Programming for Mechanical and Industrial Engineers
Institution Concordia University
Pages 7
File Size 384.2 KB
File Type PDF
Total Downloads 37
Total Views 134

Summary

Title is self explanatory...


Description

1

Using CODELITE under Linux T. Obuchowicz Sept. 8, 2016

1. Login to an ENCS Linux system. 2. Invoke the codelite IDE (Integrated Development Environment) GUI (Graphical User Interface ) by typing the word codelite from your Linux prompt. It is suggested that you first create a directory (called MECH215) and invoke codelite from your MECH215 directory as in: ted@deadflowers ~/MECH215 8:17pm >codelite

&

The main codelite GUI window appears as shown in Figure 1.

Figure 1: Main codelite GUI window. 3. Select Create New Workspace In the Select the workspace type window select C++ and click OK. Refer to Figure 2.

2

Figure 2: Select the workspace type window. 3. In the New workspace window choose a name (Hello_world) and specify the workspace path ( /home/t/ted/MECH215/codelite). Your path will be different from the example path given. You will see a Hello_world icon in the left hand portion of the codelite GUI (Figure 3).

Figure 3: Hello_world icon in codelite window.

3

4. Select Workspace -> New Project from the main menu bar. Expand Console and select “Simple executable (g++) in the New project wizard). Select Next. Refer to Figure 4.

Figure 4: New Project. 5. Specify Project name and the Project path: Select Next. Refer to Figure 5.

Figure 5: Project name and path. 6. Leave the compiler as g++ and the Debugger as GNU debugger (Figure 6)

4

Figure 6: Specifying the compiler and debugger. Select Finish. 7. In the left hand portion double click Hello -> src -> main.cpp. A C style “Hello world “ program will appear in the editor portion of the GUI. Refer to Figure 7.

Figure 7: GUI with C style program.

5

Change the code to the C++ “Hello world “ shown in Figure 8 by moving the mouse cursor to the black portion containing the text and clicking. Type in the C++ “Hello World” code.

Figure 8: Changing the code to a C++ “Hello World” program. 8. Save the file. Select File -> Save. 9. Build the Project,. Select Build -> Build Project. This will invoke the command line g++ compiler. Observe th messages in the bototm portion of the GUI window: /bin/sh -c ‘make -j 4 -e -f Makefile’ ----------Building project:[ Hello - Debug ]---------make[1]: Entering directory `/nfs/home/t/ted/MECH215/codelite/ Hello’ g++ -c “/home/t/ted/MECH215/codelite/Hello/main.cpp” -g -O0 Wall -o ./Debug/ main.cpp.o -I. -I. g++ -o ./Debug/Hello @”Hello.txt” -L. make[1]: Leaving directory `/nfs/home/t/ted/MECH215/codelite/ Hello’ ====0 errors, 0 warnings====

6

10. Run the program: Select Build -> Run. A new window appear containing the program output as shown in Figure 9.

Figure 9: Window with program output. Press the Enter key to close this window. 11. Exit from Codelite : File -> Exit. You may be asking yourselves the following question: Where does Codelite store my files? Answer: Codelite stores your files within the project directory you had specified: /home/t/ted/MECH215/codelite/Hello ted@deadflowers Hello 8:52pm >ls total 28 drwx------ 3 ted ted 4096 Sep 8 drwx------ 3 ted ted 4096 Sep 8 drwx------ 2 ted ted 4096 Sep 8 -rw------- 1 ted ted 3318 Sep 8 -rw------- 1 ted ted 4182 Sep 8 -rw------- 1 ted ted 19 Sep 8 -rw-r--r-- 1 ted ted 118 Sep 8

-al 20:36 20:48 20:36 20:36 20:31 20:36 20:36

. .. Debug Hello.mk Hello.project Hello.txt main.cpp

7

The file main.cpp in the Project directory contains the program source code you typed inside the editor portion of the window: ted@deadflowers Hello 8:53pm >more main.cpp #include using namespace std; int main() { cout ls -al total 48 drwx------ 2 ted ted 4096 Sep 8 20:36 drwx------ 3 ted ted 4096 Sep 8 20:36 -rw------- 1 ted ted 1 Sep 8 20:36 -rwx------ 1 ted ted 18891 Sep 8 20:36 -rw------- 1 ted ted 19552 Sep 8 20:36 -rw------- 1 ted ted 27 Sep 8 20:36

. .. .d Hello main.cpp.o main.cpp.o.d

The executable file has the same nae as the Project in this case “Hello” as indicated by the Linux command file: ted@deadflowers Debug 8:54pm >file Hello Hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped It can be run from the Linux prompt by simply changing to the Debug directory and typing the name from the Linux command prompt: ted@deadflowers Debug 8:55pm >Hello Hello World from Codelite IDE ted@deadflowers Debug 8:56pm > (it may be necessary to include the ./ in front of the name of the executable depending on how your Linux accounts have been configured) ....


Similar Free PDFs