Graphic library in C++

Pages: 12
Hi all,
I tried to include the graphic library in C++ as in C: #include <Graphics.h>, but got an error saying: "no such a file or directory".. How bad!
How the graphic library can be attached in C++ and use it to draw a line for example?
you must be programming in turbo C++,, are you.. that blue one??
if thats the case, there is an option somewhere for directories in settings, add the path where your graphics.h is.. thats it.

if not then what platform/compiler you are using?
I use Visual Studio 2008.
Should be included as in C? If yes, why doesn't work to me?!
Last edited on
there is no graphics.h in vc++.

so you mean when you create a c project in VS or vc++ you are able to find graphics.h file?
I want to create C++ project and not able to find graphics.h file. I think there is another way to do that in C++ but don't know how :(

For example in C# you define it like this:
g = this.CreateGraphics();
g contain all the functions like drawline, drawpixel etc.

Do you know how the syntax going in C++?
closed account (S6k9GNh0)
C++ has no graphics library.
C has no graphics library.
I didn't know C# had one but apparently it's part of the (.NET) Framework.

Of course you can just use an already made graphics library.
Last edited on
The <graphics.h> is an old Borland library for DOS.

If your professor requires using it, you can use the WinBGIm library, which is the modern Win32 emulation of that old library.

It says that it is designed for use with the GCC [MinGW], but it works with BC++ and MSVC++ also...

Hope this helps.
Thank you all..
Duoas, I don't have any professor yet :)
Learning this only to fill my time.
Ah, then I suggest you forget that old nonsense and get yourself a proper toolkit.

For games and the like, use SDL.
Get started here:

If all you want is to draw lines and the like, use a regular toolkit like Win32, wxWidgets, GDI+, FLTK, etc.

My advice here is not pure gold -- it is only intended to help you think about your design goals...

Good luck!
I may use SDL or OpenGL when reach a good advance of programming some algorithms I'm working on. I'm not a game programmer but SDL and OpenGL still useful in my case.
Thank you for the links!
> I use Visual Studio 2008.

Then graphics.h has nothing to do here.
Simply use Native Win32 Gdi apis (no need of SDL or any other external library)
Is there any recommended site which teach how to use Native Win32 GDI ?
closed account (S6k9GNh0)

Mind you, this tutorial explains very clearly that this type of programming isn't made for games.
Last edited on
you can study charles petzold also.. very good book on win32..
George is a rabid MS groupie. Win32 is not particularly simple, especially for beginners -- it is a low-level API.

If you are trying to keep it simple, go with SDL. There is nothing wrong with using non-Microsoft-made libraries, and SDL is exceedingly easy to begin with.
There once was a man called George.
Who, on Microsoft products did gorge.
When it came to third party,
Especially things arty.
He was as blind a Gordy Laforge!
closed account (S6k9GNh0)
I agree. I see nothing wrong with moving into SDL or other type APIs that can be used similarly. Win32 GDI should probably be avoided....
The portability and ease of use of SDL makes it far more preferable than using any Windows GDI gitup for basic graphic stuff, IMO.

Don't assume everyone uses Windows! Break away from the Win-only development habit by never getting sucked into it!
Now lets make a final decision!
Hmm.. According to the majority here I see that SDL is more recommended.

Thank you all :)

For just playing around with it on the fly, there is also PyGame, which works with Python.
Pages: 12