how to use the borland c++ compiler version 5.02 to create c++ and c programs annedawson

15
How to Use How to Use The Borland C++ The Borland C++ Compiler Compiler Version 5.02 Version 5.02 to create C++ and to create C++ and C programs C programs annedawson.com

Upload: sopoline-castro

Post on 01-Jan-2016

67 views

Category:

Documents


3 download

DESCRIPTION

How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson.com. Start up the Borland software. Double click on the Borland C++ icon on the desktop: - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

How to UseHow to UseThe Borland C++ The Borland C++

CompilerCompilerVersion 5.02Version 5.02

to create C++ and to create C++ and C programsC programs

annedawson.com

Page 2: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 2

Double click on the Borland C++ Double click on the Borland C++ icon on the desktop:icon on the desktop:

If the icon is not on the desktop, If the icon is not on the desktop, click on the click on the StartStart button and select button and select ProgramsPrograms from the list of options. from the list of options. From the programs list, click on From the programs list, click on Borland C++ 5.02 Borland C++ 5.02 then then Borland Borland C++.C++.

Start up the Borland Start up the Borland software software

Page 3: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 3

Page 4: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 4

You should then see the following screen. You should then see the following screen. Don’t worry if the screen is not exactly like Don’t worry if the screen is not exactly like yours – but it should have the Borland C++ yours – but it should have the Borland C++

icon and title in the top left corner.icon and title in the top left corner.

Page 5: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 5

Create a new project Create a new project

From the Borland C++ main screen, From the Borland C++ main screen, click on click on FFileile then then NNewew then then PProjectroject to get to the New Target window: to get to the New Target window:

Page 6: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 6

In the In the PProject Path and Name:roject Path and Name: text box, type:  text box, type:  

c:\temp\myprogs\prog1.ide  c:\temp\myprogs\prog1.ide   Notice that the Notice that the TTarget Namearget Name is is

automatically taken from what you automatically taken from what you type.type.

In the In the Target TTarget Tyype:pe: text box click text box click on on Application[.exe]Application[.exe] to highlight to highlight it.it.

   In the In the PPllatform:atform: text box select text box select

Win32Win32..   In the In the Target Target MModel:odel: text box text box

select select ConsoleConsole..   The remaining settings are as The remaining settings are as

shown in the New Target window shown in the New Target window above and are not changedabove and are not changed

Now click on the Advanced

button

Page 7: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 7

Click in the .def and .rc boxes to deselect them so

that the Advanced Options window looks like this:

Now click on the OK button of the Advanced

Options window. 

Then click on the OK button of the New Target window to complete the

setup for the new project. You will then see the

Project window…

Page 8: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 8

The project is called prog1. The project file is prog1.ide The project is called prog1. The project file is prog1.ide in the c:\temp\myprogs directory. Within this project is a in the c:\temp\myprogs directory. Within this project is a C++ (or C) file : prog1.cpp (or prog1.c). This is the C++ (or C) file : prog1.cpp (or prog1.c). This is the source code file, the one that contains the text of the C+source code file, the one that contains the text of the C++ or C program. prog1.exe is the name of the executable + or C program. prog1.exe is the name of the executable file to be generated from prog1.cpp (or prog1.c).file to be generated from prog1.cpp (or prog1.c).

Now click on the filename prog1.cpp ( or prog1.c) to Now click on the filename prog1.cpp ( or prog1.c) to highlight it, and press the Enter key to open the file. You highlight it, and press the Enter key to open the file. You will see a code window for C:\temp\cpp\prog1.cpp (or will see a code window for C:\temp\cpp\prog1.cpp (or prog1.c). The code window is where you to enter the text prog1.c). The code window is where you to enter the text of your program. of your program.

Page 9: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 9

Page 10: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 10

Save the projectSave the project

In the title bar of In the title bar of the code the code window, there window, there is a * after the is a * after the source code source code file name. This file name. This means that the means that the file has yet to file has yet to be saved. To be saved. To save the file, save the file, Click on Click on FFileile then then SSaveave..

Page 11: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 11

or

Page 12: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 12

Compile the project Compile the project To compile your source code (convert it to machine To compile your source code (convert it to machine

code) click on code) click on PProjectroject, and then , and then CCompileompile. If you . If you have typed everything in correctly, you should see have typed everything in correctly, you should see the following window (or a similar window for the following window (or a similar window for prog1.c).prog1.c).

or

Page 13: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 13

Click on OK.If there are any errors reported in this window, the program will not be compiled to machine code. You will need to find and correct the error, then compile again.

Page 14: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 14

Run (execute) project Run (execute) project

Once you have 0 errors, Once you have 0 errors, you then have code you then have code which will run, once which will run, once it is linked to the it is linked to the necessary library necessary library files. To compile, files. To compile, link and run a link and run a program which you program which you know has zero errors, know has zero errors, you can simply click you can simply click on the lightening on the lightening bolt button in the bolt button in the tool bar (the sixth tool bar (the sixth button from the left button from the left which has a yellow which has a yellow wavy line on it).wavy line on it).

or

Page 15: How to Use The Borland C++ Compiler Version 5.02 to create C++ and C programs annedawson

/ /١٤٤٤ ٠٩ ٣٠ 15

You will see the following window… You will see the following window…