How to write C++ program in ubuntu?

Asked by pepperblue

I am using code::blocks to write c++, and i'm a student and only know to code small programs. I used to write cpp in windows and but now, when i come to the ubuntu part, i experience many errors while compiling the code that written in TC. Where can i get a good tutorial as i have gone throug everything i can get also i googled. But no answer that solves my probs.

>What is the alternative for getch(), getche(), kbhit(), clrscr(), exit()
>Alternative header file for graphics.h, conio.h, stdio.h, process.h etc
>How can i do graphics in ubuntu cpp?
>Where can i get a complete ubuntu cpp primer soft copy?
>i was able to write as "void main()" in TC but gets error while using it here.Instead i have to rewrite it as "int main()". Why is it necessary/why is it givin error?
>what does "using namespace std" mean?
>Please give me a list of header files available in ubuntu(Will be thankful if it is orderd according to the changed headers).

Thank you in advance..
The Yash!!!

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Larry Jordan
Solved:
Last query:
Last reply:
Revision history for this message
Larry Jordan (larryjor) said :
#1

     Personally, I like "Beginning Linux Programming" by Neil Matthew and Richard Stones , ISBN: 978-0-470-14762-7. It isn't Ubuntu specific and may not be as complete as what you are looking for in all your questions, but think you would find it a good starting place and nice addition to your library. Will subscribe in case someone has another solution.

Revision history for this message
Douglas Moyes (aragorn-stellimare) said :
#2

TC allowed you to use many non-standard conventions... GCC is more strict and standard compliant.

main always returns a value of type int, so using void main() is wrong.

conio.h doesn't exist. You'll want to use ncurses.h. To learn more about that, type the following from the command line:

man ncurses

If your install doesn't include the man page for ncurses, then you're missing some pan pages. Install them with:

sudo apt-get -y install manpages-dev
sudo apt-get -y install manpages
sudo apt-get -y install funny-manpages

(the -y option tells apt-get not to ask permission before doing something)

funny-manpages inclues many amusing pages. Some of my favorites can be found with:
man rtfm
man lart

It'll also install man pages for, sex, condom, and celibacy. These were first found in the emacs source distribution.

To see a list of what pages were installed by funny-manpages. use:
dpkg-query -L funny-manpages

O'Reily also has a very good booklet on curses/ncurses. You can find it here:

http://oreilly.com/catalog/9780937175026/

Revision history for this message
pepperblue (ayashif) said :
#3

Thaz cool...
But some more remains..
>How can i do graphics in ubuntu cpp?
>Where can i get a complete ubuntu cpp primer soft copy?
>what does "using namespace std" mean?
>Please give me a list of header files available in ubuntu(Will be thankful if it is orderd according to the changed headers).
Thanks..
The Yash!!!

Revision history for this message
Best Larry Jordan (larryjor) said :
#4

      Well, as far as some of that goes, perhaps this link will help:

http://www.cplusplus.com/doc/tutorial/namespaces/

which is a lookup for "using namespace std" explaining what that means and how to fix code for it, but site is also "good cpp primer soft copy". Would also like to add that your question about graphics is somewhat ambiguous: are you referring to Graphical User Interfaces (GUI's), images, or game type graphics? GUI's are created using Tcl/Tk if you use scripting, Gtk for the gnome interface, and/or Qt which is commonly associated with KDE interfaces. Image processing is frequently accomplished using ImageMagick. Games can be written using the SDL library, but can also be done in other ways. As far as libraries, there are hundreds of them for Linux/Ubuntu if you follow the /usr/include path; you might try glib and c++ directories to find what you are looking for.

Revision history for this message
pepperblue (ayashif) said :
#5

Thazz Cool...
The Yash!!!

Revision history for this message
pepperblue (ayashif) said :
#6

Thanks Larry Jordan, that solved my question.