0

Hi!
I have a problem with graphics in c++.
It is a simple program, that displays circle.

#include "stdafx.h"
#include "iostream"
#include "graphics.h"
#include <cstdlib>
void main()
{
	int gdriver = 9;
	int gmode = 2;
	initgraph(&gdriver,&gmode,"");
	setbkcolor(WHITE);
	setcolor(BLACK);
	cleardevice();
	circle(320,240,180);
	getch();
	closegraph();

}

In visual studio i have error: error C2086: 'int right'
In Dev-C++ i have several errors:
[Linker error] undefined reference to `initgraph'
[Linker error] undefined reference to `setbkcolor'
[Linker error] undefined reference to `setcolor'
etc

I had to download some graphic libraries (graphics.h, winbgim.h), and copy it in include folder.
Can somebody tell me what's wrong with this?

Thanks!!!

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by morb
0

The functions in graphics.h are only supported by old ancient Turbo C and Turbo C++ compilers. Those functions can not be used by any modern 32-bit compiler. You can either get a copy of that old MS-DOS compiler or use win32 api GDI functions or get one of several graphics libraries such as OpenGL and QT.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.