Sie sind auf Seite 1von 1

First download WinBGIm from http://winbgim.codecutter.

org/
Extract it.
Copy graphics.h and winbgim.h files in include folder of your compiler direc
tory
Copy libbgi.a to lib folder of your compiler directory
In code::blocks open Settings >> Compiler and debugger >>linker settings
click Add button in link libraries part and browse and select libbgi.a file
In right part (ie. other linker options) paste commands
-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32
click Ok
Finally, you can now compile source code using graphics.h . Now, do your code as u
sual like you did in TC or you can try the Code below as sample. The WinBGIm lib
rary gives you an alternative as I hope, you found this guide helpful and in-cas
e you need my help just leave a message.
#include <graphics.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include<math.h>
#include<dos.h>
#include<string.h>
#include<iostream>
#include<ctime>
//using namespace std;
int main( void)
{
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver,&gmode,"d:\\tc\\bgi");
setfillstyle(SOLID_FILL,GREEN);
setcolor(GREEN);
rectangle(50,50,50+400,50+300);
floodfill(51,51,GREEN);
setfillstyle(SOLID_FILL,RED);
setcolor(RED);
circle(250,200,100);
floodfill(250,200,RED);
getch();
closegraph();
return 0;
}

Das könnte Ihnen auch gefallen