How to install, setup & include graphics.h library file in Code::Blocks IDE v20.03

Опубликовано: 20 Октябрь 2024
на канале: Anindita Das Bhattacharjee
33,564
359

In this video, I have explained how to install and setup Code::Blocks along with how to setup graphics.h library in Code::Blocks 20.03

Link to previous video regarding Linker Loader -
   • Compilation of C Programming in the c...  

Download Code::Blocks -
https://www.codeblocks.org/

Download graphics.h, winbgim.h & libbgi.a files - http://winbgim.codecutter.org/

Download 32bit Compiler -
https://jmeubank.github.io/tdm-gcc/

Other Linker Options required for setup "graphics.h" -
-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32

Sample Circle Code -
// C Implementation for drawing circle
graphics.h header file

//driver code
int main()
{
// gm is Graphics mode which is
// a computer display mode that
// generates image using pixels.
// DETECT is a macro defined in
// "graphics.h" header file
int gd = DETECT, gm;

// initgraph initializes the
// graphics system by loading a
// graphics driver from disk
initgraph(&gd, &gm, (char*)"");

// circle function
circle(250, 200, 50);

getch();

// closegraph function closes the
// graphics mode and deallocates
// all memory allocated by
// graphics system .
closegraph();

return 0;
}

Compiler Compatibility Error -
Target: x86_64-w64-mingw32