Code Blocks Ou Dev C
Code::Blocks is mostly used opensource IDE due its great features. However it can’t run graphics programs unless you include graphics.h. But we can make it work by adding WinBGIm graphics library manually. That way we can use #include<graphics.h> in Code::Blocls.
Code::Blocks is lightweight and easy to use and becoming opensource it is available for Windows, Linux and Mac and is free to download and use. It is best IDE for beginners who wants to learn and C, C++ and FORTRAN or for creating small projects. With addition of WinBGIm in Code::Blocks we can use graphics.h header file then compile and run graphics program in C++ without any errors. Let’s see how to include graphics.h in Code::Blocks.
Code::Blocks is a free, open-source cross-platform IDE that supports multiple compilers including GCC, Clang and Visual C. It is developed in C using wxWidgets as the GUI toolkit. Using a plugin architecture, its capabilities and features are defined by the provided plugins. Currently, Code::Blocks is oriented towards C, C, and Fortran. Code::Blocks is a free, open-source, cross-platform C, C and Fortran IDE built to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable. Finally, an IDE with all the features you need, having a consistent look, feel and operation across platforms. A: Code::Blocks is an Integrated Development Environment, aka IDE. Thus, a framework for working with source code and using compilers and linkers (in the case of Code::Blocks, these can be several). Thus, a framework for working with source code and using compilers and linkers (in the case of Code::Blocks, these can be several).
How to add graphics.h support in Code::Blocks?
- Download WinBGIm from the download section below. Downloading from other website may not work since official graphics.h has minor error.
- Extract it.
- Open info.txt for linker options and more information.
- Copying 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, copygraphics.h
andwinbgim.h
files in include folder of your compiler directory which isC:Program Files (x86)CodeBlocksMInGW
. And copylibbgi.a
to libfolder of your compiler directory. - 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. - In right part (i.e. other linker options) paste commands
-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
- Click OK.
Code Blocks Ou Dev Codes
If you didn’t see MinGW folder then it might be installed in different location. Check in C:MinGW.
Code Blocks Ou Dev Code
You can also watch my short video about adding graphics.h support in Code::Blocks
Now you can run graphics program in Code::Blocks by including graphics.h header. I have added a sample program clock.cpp with that WinBGIm archive file, you can try compiling it.
Note: If you are getting sstream not found error, then you probably trying to run a .c file program. sstream is c++ header so graphics.h won’t works with c.
You may also like How To Install Dark Themes In CodeBlocks?
Download WinBGIm graphics.h library
You can download corrected graphics library files from here – https://drive.google.com/open?id=1joDbQBIsnjCElEpUx4z59oWbiXcwACha
Here is the official link for WinBGIm graphics library – http://www.codecutter.net/tools/winbgim/ but it has small problem with graphics.h file which is have corrected. Line 302 has been replaced by int left=0, int top=0, int right=INT_MAX, int bottom=INT_MAX,
.
To setup OpenGL and GLUT in Code::Blocks there is a good video available in YouTube – How to setup OpenGL and GLUT with CodeBlocks on Windows.
Dev C Ou Code Blocks
MainQuick links |
|