I'm having difficulty getting graphics into my C++ program. using Ubuntu 11.10

I /think/ my problem is simply my inability to download and install graphics libraries. Basically at the #include ... section of code i get an error every time about being unable to find xyz which i haven't managed to fix. Ive tried installing several different ones on several different development programs with no success.

My questions are as follows:
1.) What library would you recommend for an exceptionally simple graphics program? 2D, and nothing more than printing out pixels, lines and circles are needed. (or what libraries might I already have and be unaware of)
2.) How do you install such a thing onto a Linux machine? I believe this has been my downfall so far, VERY detailed instructions are probably required for me I'm afraid.
3.) Where can I get some basic details of how to use the functions contained in said library?

Thanks guys,

Recommended Answers

All 10 Replies

There are several libraries available for Linux, some of which I can assure are already installed and others are easily installed from Synaptic. Examples I can think of off the top of my head include GTK+, WxWidgets, and Qt.

Thread bump

Same question for windows

As it happens, the ones I mentioned are all portable frameworks, and can be used on Windows and MacOS as well as Linux.

Point 2) from the OP is what i was looking for. (i.e the very detailed part)

Thanks Schoil,

I have already tried with Qt and failed and I also tried downloading glade gtx+ only to find it doesnt actually contain anything related to coding (so quite what it does do im not sure) i havent tried wxwidgets yet though. and i was also looking at g2 ..but the only libraries i could find for it were fortran based, although there are people that seem to use it in c++.

More importantly on my second point, how do you install them? I went through all the steps on the Qt site as far as I could tell and still no change. Either I was trying to install the wrong thing or I didnt complete the installation properly, both are equally plausable.

I guess im more asking for a step by step guide so i can work out what im missing...


I don't routinely program in a graphics environment (to make pictures, lines, objects, etc), but when I do program in a graphics environment I use OpenGl. There are multiple online sources for assistance (nehe.gamedev.net is one nice resource) and by typing in install OpenGl in Google I get multiple hits, the first two of which at least are from reputable sites I can recommend. And, who knows, if you are lucky, all the libraries you need may already be on your computer, especially if it is a Windows PC.

OpenGl, as I suspect most graphics programs, allows you to program in either 2D or 3D at your discretion.

Hi woody363,

To install Qt, you can simply install qt-creator (the main IDE for Qt). Here are the detailed instruction to install that:

1) Go to a terminal window.
2) Type this (the dollar sign not included):

$ sudo apt-get install qtcreator qtcreator-doc

3) Enjoy (the Qt Creator should appear in your applications menus, follow online tutorials on how to create Qt applications with Qt Creator).

PS: Notice how simple the instructions are, that's probably why few people would have given them to you, they are so trivial (like anything else in linux).

firsty thaks alot for that ...I think that all installed ok, many times simpler than what I was trying before!

theres still a problem though, i get the message "no valid qt versions found, please add a qt version..." when i try to run any of the C++ examples (the others run, but arnt any use to me). any ideas, there appears to be Qt4 installed but why thats not valid it doesnt say

Im now on a different computer so its not beimg effected by whatever I half installed before...

It seems like you essentially just need to know a long series of obscure passwords to run linux. Im sure its fast if you know them all.


$ sudo apt-get install libqt4-dev

You might just not have the development files for Qt (I thought they were installed along with Qt Creator, but maybe not).

Basically, you can also go into your Synaptic application (in system menus somewhere), and search for libqt and install pretty much all that seems relevant, especially those marked with "-dev".

The code you put had already been installed, Ive been on the "software center" and started installing anything that seemed relavent, but there is still alot of others.

in qt creator itself in tools/options/versions there is the option of building "qml dump" "qml debugging library" etc, if i try it says "the qt version has no tool chain." does that narrow it down perhapse?


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.