0% found this document useful (0 votes)
16 views5 pages

Initial Installation

Uploaded by

eng.mushtaq98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

Initial Installation

Uploaded by

eng.mushtaq98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Borland BGI Graphics simulation using winbgim.

Initial installation
 I first installed Dev-C++ 4.9.9.0 onto each computer in my lab by
downloading the free installation program, copying it to a folder on one of
the computers on my isolated Lan, and sharing that folder, setting
permissions simply to allow all uses to read the contents of the folder. I
then installed Dev-C++ onto each omputer.
 Students installing Dev-C++ at home, just download the installation
program and follow the steps below to setting up one computer.
 Teachers installing Dev-C++ on a lab of computers that are networked
might like to try my method in order to save time and energy. Otherwise,
the full installation procedure will need to be performed for each
computer.
 Installing Dev-C++ 4.9.9.0 on one computer
o Run the setup program.
o BE SURE to use the default directory for installation (C:\dev-cpp).
If you insist on using a different directory, BE SURE to use a
directory path that DOES NOT CONTAIN SPACES in the
pathname (this means you can't use a subdirectory of C:\Program
Files). Otherwise, your good C++ programs will not compile or run
and you will wonder why. Spaces in pathnames to your project and
source code files don't seem to matter.
o Run Dev-C++. The first time you run it, it will ask you for your
language. I chose English.
o Set the default user directory.
 Under Tools | Environment Options, click the Files &
Directories tab.
 In the "User's Default Directory" field, either type the path
you wish (you or your students) to use by default, or use the
browser (ellipsis) button to find it.
 My students all use "K:\cpp" so that's what I typed.
 Leave all other defaults "as is".
 Click the Ok button.
o
o
o
o
o
o
o
o
o

Lastly, set up the application startup documents the way you want them.
Otherwise, every time you start a new project, you'll get default file that
contains Dev-C++'s choice--which may be fine, but may not be the best
suited for high school students learning C++. In our class, we only use
C++ Console Applications, so that's the only startup document I have re-
designed.

 To change a startup document, find the appropriate text file


located in the Templates directory under C:\Dev-Cpp. For C+
+ Console Applications, we would choose
"ConsoleApp_cpp.txt". This file can be edited with Notepad
for any other text editor (NOT a word processor, so DO NOT
use Word or Works, etc.)
 This is the contents ConsoleApp_cpp.txt that I came up with.
o There is one more optional step. You may wish, at this time, to go
ahead and set things up for BGI graphics with console applications.
To do this, also include the steps below under How to add a new C+
+ Console Application with Graphics template to Dev-C++.
 The next step is to setup Dev-C++ on the remaining computers on your
network.
o Perform an initial install on each computer.
o Copy the following files from your first computer (with all the new
setup information) to each of the additional computers. You can
use a floppy, or do it across the network. I used a batch file to
automate the process and had the files copied in no time.
 C:\Dev-Cpp\devcpp.ini
 C:\Dev-Cpp\Templates\*.*

and if you installed the BGI graphics files:)

 C:\Dev-Cpp\include\conio.h
 C:\Dev-Cpp\include\winbgim.h
 C:\Dev-Cpp\lib\libbgi.a
 C:\Dev-Cpp\lib\libconio.a

Borland BGI Graphics


4 files, provided here in winbgim_devcpp4990_20041220.zip, are

1. winbgim.h (place in C:\Dev-Cpp\include)


2. conio.h (place in C:\Dev-Cpp\include)
3. libbgi.a (place in C:\Dev-Cpp\lib)
4. libconio.a (place in C:\Dev-Cpp\lib)

Download and unzip the four files, placing each in the directory indicated. If you
installed Dev-C++ in a directory other than C:\Dev-Cpp, use that instead. If you
have older versions of any of the files, delete, overwrite, rename, or remove the
older versions. The older versions are no longer useful for versions 4.9.9.0 or
later of Dev-Cpp.

Once these four files are installed, there are two more steps to use the BGI
graphics routines.

 #include "winbgim.h"
 Add these linker options to the project: -lbgi -lgdi32 -luser32
o To do this, click the Project Options icon (or, Project | Project
Options from the menu).
o Then click the Parameters tab.

o
1. Type the linker options in the Linker text field:

-lbgi -lgdi32 -luser32


note: those are lower case letters L, not the number 1

2. Click the Ok button.


This two-step procedure must be followed every time you start a C++ Console
Application in which you use BGI graphics--UNLESS you add the following to
your Dev-C++ configuration:

How to add a new C++ Console Application with Graphics template to Dev-
C++

 In the C:\Dev-Cpp\Templates directory, make a copy of the file named "2-


ConsoleApp.template" and rename it to "6-ConsoleAppGraphics.template"
 Using a text editor (such as notepad) make the following changes to the
new file:
A. In the [Template] section, change
Name=Console Application
to
Name=Console Graphics Application
B. In the same [Template] section, change

Description=A console application (MSDOS window)


to
Description=A console application (MSDOS window) with
graphics

C. In the [Unit0] section, change


Cpp=consoleapp_cpp.txt
to
Cpp=consoleapp_cpp_gr.txt
D. In the [Project] section, add the following line
Linker=-lbgi -lgdi32 -luser32
note: those are lower case letters L, not the number 1
 In the same directory, create a file named "consoleapp_cpp_gr.txt" and
place in it a sample, introductory BGI graphics program, which will be the
startup file for every C++ Console Application with Graphics. Here is
a sample.
#include <winbgim.h>
int main()
{
initwindow(400,300); //open a 400x300 graphics window
// delete these lines and replace them with your own code:
setcolor(RED);
outtextxy(20,100,"Welcome to C++ graphics!");
setcolor(GREEN);
outtextxy(60,130,"Click this window");
outtextxy(120,160,"to exit.");

// while(!kbhit()); // wait for user to press a key

closegraph(); //close graphics window


return 0;
}

After completing the above,

o You can copy your two new files to the corresponding directory of
every other computer with Dev-C++ in your lab.
o You can then easily start a new C++ Console Application with
Graphics whenever you start a new project by simply choosing the
new, sixth application template which you have created:
o

You might also like