[Share] Using anjuta in Linux to write a hello World C ++ program is so simple!

Source: Internet
Author: User
Tags automake

In IRC, people often ask what tools are used to learn C/C ++ in Linux. We recommend VI/vim and Emacs. In my opinion, it is too difficult for beginners like ours. In the impression, kdeveloper in KDE is very good, just as powerful and convenient as VC. I have never used it for a few years. I don't know how it works now.

Recently, GTK-basedAnjutaIntegrated Development Environment (IDE) is also very good, smaller, faster, and automaticCodeComplete and prompt functions! C/C ++ under netbeans? Forget it. Compared with anjuta, it is really a pediatrics; eclipse + CDT is not there, and it is not good to estimate it; and the two Java-based ides are slow and memory-consuming.

APT installation of anjuta 
There is a 1.x version in the source. Here we will install the new 2.x version, which adopts the plug-in architecture and integrates glade.
The operating system environment isUbuntu feisty 7.04, UseGutsy 7.10Please refer to this post.
The following installation steps are performed by referring to the instructions on the official website (First, close the new version and update the manager ):

1.Add Source: Click "system", "system management", and "software source" on the main menu. after entering the password, click "third-party software" in the displayed dialog box ", click "add..." in the lower left corner... ", paste the following line, and then press" add source "," "Close", and "re-load ".

Code: Deb http://anjuta.org/apt ./

2.APT Installation: Click "application" on the main menu.Program"," Attachment "," terminal ", and execute the following command:

Code: $ Sudo apt-Get install anjuta

3.Resolve Dependencies: To enable anjuta to automatically configure, compile, and work better, we need to install some necessary toolkit, such as localized "intltool" and automatic format "indent ". Run the following command on the terminal:

Code: $ Sudo apt-Get install autogen automake build-essential indent intltool


In this way, you can avoid failure to create a project, compile the project, and the following running errors (other possible errors include Autoconf, automake, and so on ).

Code: Unable to Exec g ++. Real: no such file or directory
Make: *** [main. O] Error 2
Completed... unsuccessful


Note: Ubuntu 8.04 appears"Anjuta cannot build"Problem, you can install libtool (APT-Get install libtool) to solve the problem.
Thanks to russell18721970! )

After the installation is complete, restart X (logout and then log on again) to display some icons of anjuta. Weird ==||

Write a hello World C ++ Program
1.Open anjuta: Click "application", "programming", and "anjuta ide" on the main menu ".

2.Create a project: Click "file", "new", and "4. Project" in anjuta ". When the "Application Wizard" appears, click "Forward". Select "generic c0000000000000000(anjuta-1.png) in" C ++ "for the project type, and click" Forward "and" forward "; in project options,Select "no" for all"(See Figure anjuta-2.png). Click "Forward" to apply it.

3.View Source Code: Click the "project" button on the left to switch to the "project" tab. Click project name "foobar-CPP", double-click "Main. cc" to open it, and select"Scintilla EditorOptional (this Code Completion function is attached with anjuta-3.png ).

4.Compile and run: You can see that the main () function has been written in advance. We press SHIFT + F11 to compile and press F3 to run it! (The two Shortcut Keys correspond to the menu under "generate .) (Anjuta-4.png,anjuta-5.png ))

Now, more functions of anjuta are waiting for you to explore! Click "set" and "plugins ".......

Install C/C ++ development documents
In the programming process, you may not remember the usage of a function. Generally, it is faster to query the man manual, so install the manpages-dev package. To view the usage of a function, use man. Run the following command:

Code: ~ $ Sudo apt-Get install manpages-Dev


Manpage indexes are managed by manb commands. Sometimes, after a new manpage file is installed, you may need to update the index to see man-K and man-F functions.

Code: ~ $ Mandb-C


Then you can view these documents. For example, fopen:

Code: ~ $ Man fopen

_______________________________________________
Hope the followingArticleIt can play a role for a friend who has mastered C ++ to enter the world of Linux visual GUI programming.

[Linux Visual Programming series] 
1. Use anjuta to easily build the gtkmm + libglademm Development Environment
Ii. set off the header of gtkmm + libglademm
3. Experience the Visual Interface Design of glade

Appendix:

anjuta-5.png [58.88 kib | browsed 42195 times]


anjuta-4.png [69.23 kib | browsed 42288 times]


anjuta-3.png [32.67 kib | browsed 41265 times]


anjuta-2.png [38.56 kib | browsed 41343 times]


anjuta-1.png [39 kib | browsed 41205 times]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.