-2

Unable to run the graphics from following process in DEV C++

process

Install DevC++. I installed from the Version 4.9.9.2 Setup File. Download graphics.h to the include/ subdirectory of the Dev-C++ directories. Download libbgia. to the lib/ In order to use the WinBGIm subdirectory of the Dev-C++ directories. Whenever you #include in a program, you must instruct the linker to link in certain libraries. The command to do so from Dev-C++ is Alt-P. Choose the Parameters tab from the pop-up window and type the following into the Linker area: -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32

You can now compile and run programs that use the WinBGIm graphics library, such as this one that opens a small window, draws a circle and waits for the user to press a key:

Kindly follow the same process and suggest to me

genpfault
  • 51,148
  • 11
  • 85
  • 139
user2556064
  • 27
  • 1
  • 1
  • 3
  • Why Dev C++? it's realy very old and full of bugs. – Yu Hao Jul 06 '13 at 12:48
  • Sourceforge indicates it has been superceded by http://sourceforge.net/projects/orwelldevcpp/ – holtavolt Jul 06 '13 at 12:53
  • What do you mean by "Unable to run"? Where are stuck when following these instructions? `"Kindly follow the same process and suggest to me"`? What? It works on my machine, and it doesn't on yours, so how are we even supposed to help here if we don't know what is your problem? – milleniumbug Jul 06 '13 at 13:17

3 Answers3

3

Download following files to the directories mentioned:

Here I assume you installed Dev-Cpp to C:\Dev-Cpp

http://www.cs.colorado.edu/~main/bgi/dev-c++/graphics.h Directory:> C:\Dev-Cpp\include http://www.cs.colorado.edu/~main/bgi/dev-c++/libbgi.a Directory:> C:\Dev-Cpp\lib

Create a new C++ project and set "Project Options->Parameters->Linker" as

-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32

and try executing this sample code; then go for the code that you have :)

#include<graphics.h>

int main( ){
        initwindow( 700 , 700 , "MY First Program");
        circle(200, 200, 150);
        getch();
        return 0;
}
Saravanabalagi Ramachandran
  • 8,551
  • 11
  • 53
  • 102
  • Are you the author of this blog: http://innamhunzai.blogspot.in/2013/03/how-to-add-graphicsh-header-file-in-dev.html – user31782 Dec 20 '14 at 13:20
  • The above second link is not working so for that I found this article more useful and it worked for me! Here is the link for that: https://www.narendradwivedi.org/2021/08/add-graphics-in-dev-cpp.html – Deepak Kumar Dec 10 '22 at 16:45
3

I tried using graphics.h with Dev C++ on windows 10 recently.

These are the steps I followed :

1) Download the setup file for Dev C++ 5.11 from Sourceforge and install it

2) Download the following folder and extract it's contents. It contains the header and library files for graphics. On unzipping you should get 3 files namely, graphics, winbgim and libbgi.a https://drive.google.com/file/d/0B5k4Y85A4nwRdjNFWlEweEJmNjQ/view?usp=sharings

3) Copy and paste the files graphics and winbgim into C:\Program Files (x86)\Dev-Cpp\MinGW64\include and C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\include . The path may vary slightly depending on where you install Dev C++, it's usually installed in the above specified paths by default.

4) Copy and paste the file libbgi.a into C:\Program Files (x86)\Dev-Cpp\MinGW64\lib and C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib

5) Open a new project in Dev C++ and choose Empty project.

6) Press Ctrl+H and choose the parameters tab in the window that opens. Copy paste the following in the linker column -lbgi -lgdi32 -luser32

7) In the title bar, choose TDM-GCC 4.9.2 32-bit Profiling option in the dropdown

8) Copy paste the following code to test if the graphics.h library is working correctly or not. On executing the coding you should get a window with a circle.

int main()
{   

int gd=DETECT,gm;
initgraph(&gd,&gm,"C:\\TC\\BGI");

circle(200,200,100);

getch();
closegraph();

}

Hope this helps ! :)

Chandana N T
  • 151
  • 1
  • 6
1

download the visual c++ express, it is the present devc++ is past