C++ graphics

Ok I'm new and I want to get into graphics and someday videogames. I've tried using graphics.h but can't get c++ to find it with the include command. Instead, I want to try
a graphics program. I want someone to walk me through how to use it, and especially how to find it with c++ with the include command.
Anyone who can help would be appreciated.
C++ Doesnt have a graphics library, use SDL or another 3rd party graphics library.
Google "SDL lazyfoo". Some of the best tutorials on the web in my opinion. If you like video tutorials thecplusplusguy is ok (some people aren't mature enough to handle his accent though -_-)

I hope you didn't just download the files throw them somewhere carelessly then just try graphics.h as a pre-processor. You'll need to mess around with your IDE settings, which will depend on which IDE you are using. There are plenty of tutorials on youtube for this.
Last edited on
Ok I will look at youtube sometime.


I haven't downloaded sdl yet.

I have downloaded graphics.h. It's in the same folder I have all my finished programs in. Which folder is graphic.h supposed to go? Also, do I need to download anything else to find graphic.h for me?
It looks like I might of done something right. I put graphics.h in
with other programs like it and all the errors conected with graphics.h dissapeared.

#include <graphics.h>

int main( )
    initwindow(400, 300, "First Sample");
    circle(100, 50, 40);
    while (!kbhit( ))
    return 0;

Now, all I'm getting are linked errors.

[Linker error] undefined reference to ‘initwindow'
[Linker error] undefined reference to ‘circle'
[Linker error] undefined reference to ‘delay'
Id returned 1 exit status

What should I do to get rid of those errors?
You must configure your linker settings.

Do you mean the linker settings in
tools\compiler options\settings\linker?
The options are
Link an Objective C program yes\no
Generate debugging infoimation yes\no
Do not use standard system startup files or libraries yes\no
Do not create a console window yes\no
Strip executable yes\no
Do I change some of these?
I have written 2 books about game programming
I am sure you will benefit, even though it's not about sdl
Take a look yourself

Now I want to go through 3D programming, but that is a real pain (and beautiful too ;))
Last edited on
Sorry about the slow reply, I was reading your book!
First, thank you for making a free book about c++, it help a TON.
Secondly, I'm not done reading it, I'm on page 11.
And so, I'm still reading it so it might be another day or so.
Also, I've done robotC, a version of C used for robots, so I kind of had an idea of what c++ would be like. I'm also doing a programming language called autohotkey which is good at doing things with the computers.
I am really glad you liked it :)
I might add a new book by next month if I have enough free time
Good luck with your projects
So I should use something called Allegro 5? Is it a version of C++? Interesting. The only game programming I've done is with robotC. It uses a microcontroller called a Lego Mindstorms NXT. Its about 60x99 in pixels. All I did is make stuff like circles move around on the screen and make them move when buttons on the NXT are pressed. My friend has made some more advanced video game programs on the NXT that look like videogames.
So I'm just waiting to start making the videogames!
It looks to me like graphic.h is outdated. I think I'll use the graphics library in my first post.
Can someone tell me what I should download from
there are so many things that look like should be used.
closed account (3CXz8vqX)
If you have the MinGW compiler you'll need... (if you're using windows)


or for VC++

and the run time...

http://www.libsdl.org/release/SDL-1.2.15-win32.zip for 32 bit windows.

...of course, you 'could' download linux, boot it live and just select SDL-devel from the repository and be done with it... but no, people are still against linux *sighs*. The reason I say this is because I know how damn annoying it is to install MinGW
Ok yeah, I'm going through the lazyfoo tutorial. I am super annoyed because http://www.libsdl.org/release/SDL-devel-1.2.15-mingw32.tar.gz
doesn't have a folder in it, while lazyfoo says it does. First I couldn't open the .tar so I got 7-zip which opened the .tar. It ends up the .tar doesn't have a folder in it. What do I do now???
Please help me with this one.
I would strongly suggest you develop higher knowledge on C++ before venturing into game programming. Nearly 100% of programmers who want to built games, try to start as soon as possible, which is very bad, you will just ask people to help you out without any progress at all. You will see some weird stuff which the gaming library has nothing to do with, or even worse, not knowing how to built the stuff yourself to start the easiest tutorial.

If you want to build games, I would strongly suggest to go with UDK.
If you want to program games, I would suggest learning C++ at least the simplest concepts, like pointers, structs, header files (the last two were included in my book so you should know I guess)
From what I could gather is that you do not have enough knowledge of programming, which is needed. Even though you knew the basic concepts, your game is going to suck.

Note: Allegro 5 and OpenGL 4.0 had the same installation (nearly the same) and from what I could gather, the idea is that all libraries should have the same installation. You will better be off learning C++, since I made the same thing as you 2 years ago and came back to C++ to learn a lot of stuff.

SDL is known to be easier than Allegro 5, meanwhile others say the contrary. It all depends what you really mean. The file actually had a folder, because you have to open it with WinRar.

Read a C++ book with a lot of pages than you will learn stuff alone.
The better your C++ skills, the better the games you will make will be.

Otherwise, read my Allegro 5 book ;)
Last edited on
Dang I had my reply post ready and I lost it so this will be short.

Thank you for telling me this.
I will get WinRar and try my luck. I will also get more experience with C++ as time goes on. The reason I'm trying to learn stuff so fast is that in the last 2 months I've learned the programming language autohotkey sucessfully, so I feel like I can learn every programming language there is. Autohotkey has no graphics, so here I am. I also chose to learn C++ because it has good mobility, and can do many things besides graphics that autohotkey cannot. I will read your Allegro book. : )
I also do robotics, as well as autohotkey, so I am busy with other stuff.
thanks : )
Another good info I found from a 30 year experienced programmer:

Do not learn C/C++ at first
You should start young like 8-12 years old
It takes a LOT to learn and is the most difficult subject of all
Don't start 2D/3D programming if you dont even know how to link libraries
You should write text based games, until you create your own scripting language

Thats all i could gather, but I think that this guy is somewhat not right 100%
Last edited on
How is it possible to make a programming language? I do have some experiance, doing robotC and autohotkey. Yes, I should probably know a lot about C++ before I try videogames. Autohotkey can do a lot, but one thing it can't do is graphics. Thank you for that info, and the next time I go to our library I'll get a C++ book.
Topic archived. No new replies allowed.