programing in ubuntu

May 16, 2014 at 10:03pm
hello friends ..
how to use graphics in ubuntu(terminal).
or
how to use Linux command in c++ program.
Last edited on May 16, 2014 at 10:06pm
May 17, 2014 at 5:31am
Your question isn't very clear, but just write your c++ program using Gedit, the default Ubuntu text editor.

Then save the file as filename.cpp, and compile in the terminal with

g++ filename.cpp

This will create an executable called "a.out", which you can run with

./a.out
May 17, 2014 at 7:29am
I want to add graphics in my c++ program with the use of ubuntu.
May 17, 2014 at 9:44am
By graphics, I assume you mean windows and/or games or things. There are a few ways, but I recommend getting Qt - get it from https://qt-project.org/downloads

Qt is a toolkit for making windows in a cross-platform manner, and it is much easier than going to native code (especially for Linux systems). If you want to make games, though, as well as Qt there are also things like SFML, SDL, GLFW and others to create windows for you, which are simpler to get something up and running than Qt, at the loss of being able to do anything apart from making a game as easily. Its really down to what you want to do.
May 17, 2014 at 12:44pm
sorry but I cant use qt because my project in c++ with ubuntu ....
I want to add some graphics in my project so how can i do ?? in ubuntu??
May 17, 2014 at 1:05pm
sorry but I cant use qt because my project in c++ with ubuntu ....

? What does your project being in C++ have to do with anything?

If you are opposed to using libraries, you could always use XLib (though I'd recommend against it). There is a decent tutorial here: http://www.unix-manuals.com/tutorials/xlib/xlib.html

Another good beginner one is this one: https://user.xmission.com/~georgeps/documentation/tutorials/Xlib_Beginner.html
May 22, 2014 at 1:04pm
but I cant use it because i work only ubuntu .. so give solution related to ubuntu
May 22, 2014 at 1:07pm
Install Qt and use it. That is the Ubuntu way.
May 22, 2014 at 1:19pm
Ubuntu is the name of your Linux distribution. If you want to use graphics in your program you will have to use a library (Qt, GTK+, SFML, SDL, Allegro, Xlib, ...). It doesn't really matter if you use Ubuntu or not because those libraries are available for all Linux distributions.
May 22, 2014 at 1:35pm
I just noticed the OP mentions the word terminal so I guess he want's graphics in the terminal, colored characters and stuff like that.

Well, in that case you should take a look at the ncurses library.

If you really don't want to use a library you can mess around with the ANSI escape codes (http://en.wikipedia.org/wiki/ANSI_escape_code).
1
2
3
4
5
6
#include <iostream>

int main()
{
	std::cout << "\033[1;34mbold blue text\033[0m" << std::endl;
}
Last edited on May 22, 2014 at 1:35pm
May 22, 2014 at 4:17pm
Asking a question is real hard.
May 22, 2014 at 4:44pm
Resident Biscuit wrote:
Asking a question is real hard.

Nah, asking questions is easy. Asking an informed question that won't be ridiculed as not being detailed enough or making sense so others know what you are needing help with is real hard especially if you aren't 100% sure how to word it or the terms for what you are wanting to make.
May 26, 2014 at 2:02pm
hey friend listen i want to use graphics in only gcc compiler with scite editor.
in ubuntu so give me solution it related.
May 26, 2014 at 3:13pm
Unfortunately, if you can't tell from the replies above, we aren't even sure what you mean by "use graphics". Are you talking ASCII graphics or 2D graphics because I've seen beginners refer to using 2D graphics as using graphics in terminal. The above replies tried to accommodate your vagueness of the question, but without knowing exactly what you mean by "use graphics" I'm afraid we can't get any more specific other than what has been recommended already.
May 27, 2014 at 1:50am
Understand that all the answers have described how to "use graphics" using C++ on Ubuntu. Try to explain what it is you want to do exactly.
Topic archived. No new replies allowed.