Setup DevC++ for Computer Graphics Lab

Because TurboC3 sucks

Priyansh Khodiyar
2 min readFeb 14


To run C or C++ programs that require the use of a graphics library in DevC++, follow along.

We all share the hate for TurboC3 and hence the genesis for this article. I was compelled to write one. Things will work fine if you use TurboC3 for your Graphics lab work, but it seriously sucks.

Steps to run graphics in DevC++:

  1. Make a new project, not a new individual source file.
  2. Inside the project, make files that are interrelated (thus only 1 main function for the entire project)

3. DevC++ → Tools → Compiler Options, and write the following as shown in the image.

-static-libgcc -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32 

4. Select TDM-GCC 4.9.2 32-bit-release from the above menu for the choice of compiler, play around with using the 64-bit version, but 32-bit worked for me just fine.

5. Header files to use:


6. Sample main ()

int main(){
int ch,gd=DETECT,gm;
initgraph(&gd, &gm, "C:/TURBOC3/BGI");
outtextxy(10,80,"ENTER UR CHOICE:");
case 1:
case 2:
return 0;

7. Rest, if you still get some error like `-lgbi not found` or some other error, then you can find out how to resolve them over the internet.

This is how my working DevCpp file structure looks like.


these files will be useful in your proper compiler working and linking


add graphics.h header file in this location

Do a quick Google search to get these files if they are not present in your installation.

that’s all folks. Enjoy.

I hope you got clarity out of this article and would love to hear your thoughts about (I missed something?), so feel free to reach out to me on LinkedIn or Twitter or respond in the comments below/sideways.

Do reach out, I would love to talk to you.

— If this article helped you in any way, consider sharing it with 2 friends you care about.

Till then stay alive.



Priyansh Khodiyar

I write highly researched technical articles on things I daily learn, sometimes code, and interview people. Check my About section.