There are so many IDEs
to run C programs but not every IDE would have that user friendly environment
and even may not be familiar with some features.Like those IDEs , CodeBlocks is
a user friendly IDE with an attractive environment and is compatible with
languages like C and C++.But before getting started with programming in
CodeBlocks,these 4 features are to be installed to avoid errors .
1.Graphics Header Files.
Compiling
graphics file would show “Cannot find graphics.h”.
This is because graphics.h runs is not available in the library folder of
Code::Blocks. To compile graphics code on Code::Blocks, you need to
setup winBGIm library.You can do it in following steps.
Step 1:To setup “graphics.h” in
Code::Blocks, graphics library. Download WinBGIm graphics library from http://winbgim.codecutter.org/ .
Step 2:Extract the downloaded file.
There will be three files:
graphics.h
winbgim.h
libbgi.a
Step 3:Copy and paste graphics.h and winbgim.h files
into the include folder of compiler directory. (If you have
Code::Blocks installed in C drive of your computer, go through: Disk C >>
Program Files >> CodeBlocks >> MinGW >> include.
Step 4:Copy and paste libbgi.a to
the lib folder of compiler directory.
Step 5:Open Code::Blocks. Go to Settings >> Compiler >>
Linker settings.In that window, click the Add button under the “Link libraries”
part, and browse.Select the libbgi.a file
which was just copied in step 4.
Step 6: In right part paste commands:
-lbgi
-lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32.
You
are ready to go with graphics in c.
2.Themes
In Code::Blocks,initially,you
are available with only one theme.If you need dark or some costumized theme,you
gotta follow those steps:
Step 1:Download this given file.(
https://drive.google.com/file/d/1qj6UpKXokr_QHLrRalMrTcMjsed8vKcI/view )
(Source:Sangam.com.np)
Step 2:Goto C:\Program Files
(x86)\CodeBlocks and open cb_share_config and open it.Click on the (…)like
symbol and add the downloaded file and click transfer.) and close Code::Blocks.
Step 3:Open Code::Blocks,goto
settings->editor and syntax highlighting and choose your fav theme.
3.Gotoxy function
You cannot use Gotoxy function
in Code::Blocks until you declare given function and implement it.
#include<stdio.h>
COORD coord= {0,0}; //
this is global variable void gotoxy(int x,int y)
{
coord.X=x; coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
4.Opening
graphics window in full screen
You will not be able to run graphics in full
screen.Whenever you need to see a bigegr graphics,you may get a quarter window
and will be so irritating.You gotta enter some code to make it run in full
screen mode.Enter this code to get a full screen graphics window.
initwindow(2000,2000,"Big Window ");
Happy coding :)
kada
ReplyDeletesir