Include graphics.h in CodeBlocks – Run Graphics Program in C++


Please LIKE & SUBSCRIBE if you liked this video.
Download from here:

graphics.h can be used in CodeBlocks by adding WinGBIm in MinGW compiler. Some header files and library files should be copied in the compiler directory & linker should be configured to run graphics program in CodeBlocks using C and C++.

If you are getting sstream not found, then you probably trying to run a .c file program. sstream is c++ header so graphics.h won’t works with c.

1. Download WinBGIm. Downloading from other website may not work.
2. Extract it.
3.Open info.txt for linker options and more information.
4. Copy MinGW folder to your Code::Blocks installation directory. Default Code::Blocks installation directory is C:Program Files (x86)CodeBlocks. There will be MinGW folder already. Copying new MinGW folder only adds some library (libbgi.a) and header (winbgim.h, graphics.h) files in that directory. To manually add files, copy graphics.h and winbgim.h files in include folder of your compiler directory which is C:Program Files (x86)CodeBlocksMInGW. And copy libbgi.a to lib folder of your compiler directory.
5. Open Code::Blocks. In open Settings – Compiler – Linker Settings. Click Add button in link libraries part and browse and select libbgi.a file you just copied to MinGW folder.
6. In right part (i.e. other linker options) paste commands -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
7. Click OK.
If you don’t find MinGW inside codeblocks check in C:MinGW


View More: Cuocdoidanghien Education


  1. Did you like that theme? If you did, here is the video on installing dark theme in Code::Blocks.

  2. i have more 2 simple questions:
    1 – the conio.h(that have the gotoxy()clear()textcolor() and others, is compatible with Linux too?
    2 – the GNU windows.h is compatible with Linux, or is used another header file?

  3. I keep getting error " undefined reference …" Any program I run with the header file graphics won't run. Same in dev c++ why is it so?

  4. Hi!
    Dude does it matter if I use codeblock and coding in C language will it still work?

    I've coded the "game of life" game. In my mac it is working but I want to code in my win 10 so thats the reason why i am asking you 😉

  5. At 2:39 in my case it is always crashed by saying that the program stopped working? Got any idea why is that?

  6. thank you very much really help ful i wont tell my friends about it so they be lost, you are good man from russia with love

  7. love u londe jeher kai dino se solution dhund raha tha finally mil gaya
    bye the way mera bhi channel h
    code via Gaurav

  8. Bro it worked and really really thank you…
    Guys believe me it really works and one important thing to follow is download all the files given in the description by him …
    Thank you again bro


Please enter your comment!
Please enter your name here