Instructions for installing Dev-C ++

This article explains how to compile programs written in ANSI C with OpenGL and GLUT using the Dev-C ++ compiler.

This article explains how to compile programs written in ANSI C with OpenGL and GLUT using the Dev-C ++ compiler.

Bloodshed Dev-C ++ is a free C ++ compiler and development environment for Windows operating systems. Like most C ++ compilers, it can also be used to compile ANSI C. By installing library files and GLUT headers, it can be used to write programs that use OpenGL. . This is necessary to run programs in Edward Angel's Interactive Computer Graphics, 5th edition and possibly other computer graphics books.

This article does not explain how to compile OpenGL with C ++. The 6th edition of Angel's book using C ++ will not work with these instructions.

These instructions have been tested on a variety of Windows 2000 and Windows XP systems. These systems come with the necessary files for OpenGL, but are not necessary files for GLUT.

Dev-C ++ does not work well with Microsoft Windows Vista.

Instructions for installing Dev-C ++

  1. I. Download and install Dev-C ++
  2. II. Start DEV-C ++ and try installing with a simple C program
  3. III. Download and install GLUT
  4. IV. Check Dev-cpp with GLUT

I. Download and install Dev-C ++

Link download: http://www.bloodshed.net/dev/devcpp.html

Detail:

Download Dev-C ++ 5.0 beta 9.2 (4.9.9.2) (9.0MB) with Mingw / GCC 3.4.2 Although this is a "beta" version, it works perfectly well. Click SourceForge to access the list of download pages and select a page. The file will look like devcpp4.9.9.2_setup.exe. Save this file in C: Temp.

Instructions for installing Dev-C ++ Picture 1Instructions for installing Dev-C ++ Picture 1

When the download process is complete, click the "Open" button to start the installation process (or go to C: Temp and double-click devcpp4.9.9.2_setup.exe). You will see a few screens that require you to choose a language (English) and agree to the license terms. Select "typical" installation.

Instructions for installing Dev-C ++ Picture 2Instructions for installing Dev-C ++ Picture 2

Accept the proposed destination location to install:

Instructions for installing Dev-C ++ Picture 3Instructions for installing Dev-C ++ Picture 3

Many subdirectories and files are extracted to this target location:

Instructions for installing Dev-C ++ Picture 4Instructions for installing Dev-C ++ Picture 4

Select 'Yes' when asked if you want to install Dev-cpp for all users.

Note : If the installation fails, please reinstall and try selecting "No" in this step.

A screen indicating the installation process is complete:

Instructions for installing Dev-C ++ Picture 5Instructions for installing Dev-C ++ Picture 5

Keep the traces in the above dialog box. Click "Finish". The configuration screen for the first time will appear:

Instructions for installing Dev-C ++ Picture 6Instructions for installing Dev-C ++ Picture 6

Select "English" and " New Look ". In some subsequent screens. Select "Yes" for the suggestions displayed.

Instructions for installing Dev-C ++ Picture 7Instructions for installing Dev-C ++ Picture 7

Finally, you are finished. Click OK.

Instructions for installing Dev-C ++ Picture 8Instructions for installing Dev-C ++ Picture 8

II. Start DEV-C ++ and try installing with a simple C program

Detail:

The program will automatically start.

Instructions for installing Dev-C ++ Picture 9Instructions for installing Dev-C ++ Picture 9

Click File> New> Project . Select a name for the project (such as "myProject"). Click " C Project ". Click on " Empty Project ". Click "OK".

Instructions for installing Dev-C ++ Picture 10Instructions for installing Dev-C ++ Picture 10

In " Create New Project ", click "Save" (later you may want to create separate subfolders for your different projects).

Instructions for installing Dev-C ++ Picture 11Instructions for installing Dev-C ++ Picture 11

Click File> New> Source File and in " Add source file to current project ", click "Yes". You should now see a screen where you can edit the source file.

Enter a simple C program, as shown below. Now click File> Save As and save the file as "hello.c" (or another name).

Important note : Make sure the file extension is .c. With any other extension (such as the recommended .cpp), you will have problems compiling.

Instructions for installing Dev-C ++ Picture 12Instructions for installing Dev-C ++ Picture 12

Now click Execute> Compile and Run .

The program will be compiled, run and write its results into a DOS window. If you have a system command ("pause") in the program, the result will be in the window until you press a key. Another way to run the program (after it has been compiled) is to start a DOS window outside the Dev-Cpp system, then navigate to the subdirectory that contains your project and type hello.exe.

Instructions for installing Dev-C ++ Picture 13Instructions for installing Dev-C ++ Picture 13

At this point, the compiler and development environment have been installed. You need to find Dev-C ++ listed in "Programs" on the Start menu and will now be able to write, compile and run C programs (and C ++). You will have everything, including files, libraries, and dlls for OpenGL (as well as all other standard packages) but without GLUT. GLUT manages windows and other user interface components necessary for OpenGL programming and needs to be installed separately.

If you don't need GLUT, you can quit it now.

III. Download and install GLUT

To run OpenGL with GLUT (that's what the programs in Angel's book use), you need to get 3 files and put each file in its proper directory. All files you need (and more) are contained in a zip file.

Detail:

Download link: http://chortle.ccsu.edu/Bloodshed/glutming.zip

Download the glutming.zip file and save this zip file in a convenient location (probably C: temp).

Instructions for installing Dev-C ++ Picture 14Instructions for installing Dev-C ++ Picture 14

Double click glutming.zip (or extract it). You will see the files in the zip archive. (Your decompression program may differ from the program shown here, but will work similarly).

Instructions for installing Dev-C ++ Picture 15Instructions for installing Dev-C ++ Picture 15

Click "Extract" to extract all subdirectories and files. Select some convenient directories to extract them (probably C: tempglutming). You only need 3 files, but still have to extract all of them.

Instructions for installing Dev-C ++ Picture 16Instructions for installing Dev-C ++ Picture 16

Only 3 files in different subdirectories are needed. Each of these 3 files must be placed in subdirectories with other files of the same type. Use Explorer to move files where needed.

Note : If you only see some files listed in Explorer, click View> Options> View and then select the " Show all Files " button.

glut.h - copy this file to C: Dev-CppincludeGL

Copy from your "unzipped" subdirectory (wherever they are):

Instructions for installing Dev-C ++ Picture 17Instructions for installing Dev-C ++ Picture 17

Here:

Instructions for installing Dev-C ++ Picture 18Instructions for installing Dev-C ++ Picture 18

libglut32.a - copy this file from the unzipped folders to C: Dev-Cpplib

There may be a newer version of this file there. Replace that version with the version you unzipped (if you keep the newer version, your program will not link correctly).

Copy from "unzipped" subdirectory:

Instructions for installing Dev-C ++ Picture 19Instructions for installing Dev-C ++ Picture 19

Here:

Instructions for installing Dev-C ++ Picture 20Instructions for installing Dev-C ++ Picture 20

glut32.dll - move this file to C: WINNTSystem32, or similar location.

The location for this file depends on your operating system. The folder that it was moved to is the folder containing the Dynamic load library (* .dll). An easy way to find where to put it is to find glu32.dll (use the Search tool from the Start menu).

Instructions for installing Dev-C ++ Picture 21Instructions for installing Dev-C ++ Picture 21

Folders to use should also have glu32.dll and opengl32.dll files . These files should be included with your operating system.

IV. Check Dev-cpp with GLUT

An important step in compiling and running a C program containing OpenGL and GLUT functions is to let the linker know where the libraries are. This is done by clicking Project> Project Options> Parameters> Add Library or Options and then navigating to the libraries you need including: libopengl32.a, libglu32.a and libglut32.a. Libraries should be added in this order.

Detail:

a. Create a subfolder for a project. Do this first, before you start Dev-Cpp. Create a new subdirectory with "Explorer" by clicking File> New> Folder .

Instructions for installing Dev-C ++ Picture 22Instructions for installing Dev-C ++ Picture 22

For example, create a folder C: GLproject.

b. Start Dev-cpp:

Instructions for installing Dev-C ++ Picture 23Instructions for installing Dev-C ++ Picture 23

c. Start a new project by clicking File> New> Project . In the resulting panel, name the "rectangle" project, click " Empty project " and " C ": Click OK.

Note : To compile with OpenGL, you must create a project. You need to have a project (not just a single C file) to link in OpenGL libraries.

Instructions for installing Dev-C ++ Picture 24Instructions for installing Dev-C ++ Picture 24

d. In the next panel, navigate to your directory C: GLproject and click "Save".

Instructions for installing Dev-C ++ Picture 25Instructions for installing Dev-C ++ Picture 25

e. In Dev-C ++, click File> New> Source File and then in the next " Add to Project " control panel, select "Yes". Click File> Save As and then name the file. Navigate to the project subdirectory to save the file in it. Name the file "rectangle.c"

Make sure the file names end in ".c" because anything else will cause major problems.

Instructions for installing Dev-C ++ Picture 26Instructions for installing Dev-C ++ Picture 26

f. Click and drag over the following program to highlight it, then click Edit> Copy from the browser menu bar.

 #include 

const int A = 500; / * chiều dài của một side của cửa sổ Monitor * /
const float B = 500; / * length của một side của các clipping rectangle * /
const float C = 200; / * chiều dài của cửa sổ của chương trình Draws * /

void myinit (void)
{
glClearColor (0.7, 0.7, 0.7, 0.0); / * gray background * /

glMatrixMode (GL_PROJECTION); / * In World coordinates: * /
glLoadIdentity (); / * position the "clipping rectangle" * /
gluOrtho2D (-B / 2, B / 2, -B / 2, B / 2); / * at -B / 2, its right edge at + B / 2, its bottom * /
glMatrixMode (GL_MODELVIEW); / * edge at -B / 2 and its top edge at + B / 2 * /
}

void display (void)
{

glClear (GL_COLOR_BUFFER_BIT); / * clear the window * /

glMatrixMode (GL_MODELVIEW); / * Các bản sau sau được sử dụng * /
glLoadIdentity (); / * in terms of World coordinates * /

glBegin (GL_POLYGON); / * draw a filled polygon * /
glColor3f (1.0, 0.3, 0.2); / * draw in light red * /
glVertex2f (-C / 2, -C / 2); / * (x, y) * /
glVertex2f (C / 2, -C / 2); / * (x, y) * /
glVertex2f (C / 2, C / 2); / * (x, y) * /
glVertex2f (-C / 2, C / 2); / * (x, y) * /
glEnd ();

glFlush (); / * send all commands * /
}

void main (int argc, char ** argv)
{
glutInit (& argc, argv);
glutInitWindowSize (A, A); / * A x A pixel screen window * /

glutInitDisplayMode (GLUT_RGB | GLUT_SINGLE);
glutCreateWindow ("My Rectangle"); / * window title * /
glutDisplayFunc (display); / * tell OpenGL main loop what * /
myinit (); / * set attributes * /

glutMainLoop (); / * pass control to main loop * /
}

g. Now, click in the Dev-cpp editing window and then click Edit> Paste in its menu. The program will appear in the edit window.

Instructions for installing Dev-C ++ Picture 27Instructions for installing Dev-C ++ Picture 27

hour. Click File> Save . The file in your project directory will now contain the OpenGL program.

i. Let Dev-cpp know which library to link to. Click Project> Project Options .

Instructions for installing Dev-C ++ Picture 28Instructions for installing Dev-C ++ Picture 28

j. Now click "Parameters". Click the " Add Library or Object " button and navigate to the libraries that will be added. They are found in C: Dev-cpplib

  1. ./lib/libopengl32.a
  2. ./lib/libglu32.a
  3. ./lib/libglut32.a

Add them in that order. Note that the slash will appear in the Unix style "/" and not the "DOS type".

Instructions for installing Dev-C ++ Picture 29Instructions for installing Dev-C ++ Picture 29

When you have finished adding these 3 libraries, you will see:

Instructions for installing Dev-C ++ Picture 30Instructions for installing Dev-C ++ Picture 30

The exact template has the form "././ ." you see depends on the complexity of the directory structure in which your source file resides.

Click OK.

k. Click Execute> Compile and Run . The program will be compiled, linked and run:

Instructions for installing Dev-C ++ Picture 31Instructions for installing Dev-C ++ Picture 31

If everything doesn't work (very popular), click the " Compile Log " tab to find some confusing error messages. If you see an error like this, it means you made the wrong order when adding libraries to the project:

Instructions for installing Dev-C ++ Picture 32Instructions for installing Dev-C ++ Picture 32

Try to edit the library list or start over.

You have now completed the steps.

Good luck!

See more:

  1. Installation instructions C
  2. Web programming in C ++
  3. Multithread in C ++
5 ★ | 1 Vote