Build a C/C ++ development environment in Ubuntu

Source: Internet
Author: User
Tags valgrind wxwidgets

I recently installed Ubuntu In the VM. To develop the program, I found some materials on the Internet for your reference due to the C/C ++ development environment.

The following text mainly describes how to set up Code: Blocks + wxWidgets.

Procedure:

1. Install the compiling environment, C library, C ++ library, and Boost library.

Command executed on the terminal:

Sudo apt-get install libc6 libc6-dbg libc6-dev glibc-doc libstdc ++ 6 libstdc ++ 6-4.2-dbg libstdc ++ 6-4.2-dev libstdc ++ 6-4.2-doc libboost *

To update the Library mentioned above, you need to execute the following command:

Sudo apt-get install build-essential

2. Install the debugging component Valgrind (used to detect memory leaks)

Command executed on the terminal:

Sudo apt-get install valgrind

3. Install gdb

Command executed on the terminal:

Sudo apt-get install gdb

4. Add a software update source

Command executed on the terminal:

Sudo cp/etc/apt/sources. list/etc/apt/sources. list. bak

Sudo gedit/etc/apt/sources. list

Then add the following two update addresses in the document that appears.

Deb http://apt.tt-solutions.com/ubuntu/ edgy main

Deb http://apt.tt-solutions.com/ubuntu/ feisty main

Command executed on the terminal:

Sudo apt-get update

Sudo apt-get dist-upgrade

Save the disk and exit gedit.

5. Install the Public Key

Command executed on the terminal:

Wget-q http://apt.wxwidgets.org/key.asc-O-| sudo apt-key add-

Wget-q http://lgp203.free.fr/public.key-O-| sudo apt-key add-

Wget http://www.tt-solutions.com/vz/key.asc

Sudo apt-key add key. asc

6. Installation Code: Blocks latest version and wxWidgets :( Note: Find the latest version before installation, www.wxWidgets.org)

Command executed on the terminal:

Sudo apt-get install Plugin-0 libwxbase2.8-dbg libwxbase2.8-dev Plugin-0 Plugin-dbg Plugin-dev wx2.8-doc wx2.8-examples wx2.8-headers wx2.8-i18n wx-common

Sudo apt-get install codeblocks-contrib libcodeblocks0 libwxsmithlib0

Installation is basically complete

Click Application> programming> Code: Blocks IDE to check whether the development environment has been installed successfully.

Configure Code: Blocks IDE

1. Font settings:

Choose Settings-> Editor-> General Settings and select the Font choose button. Here, the recommended Font is Monaco and the size is 12 (Note: The fonts in Ubuntu only need to be downloaded online, click to install the SDK ).

2. Define shortcuts

You can only define shortcuts for projects that appear in the menu.

Settings-> Editor-> Keybord shortcut cut

3. Automatic prompt

Settings-> Editor-> Code-completion and symbols browser

Automatically lauch when typed # letters: 2

Delay for auto-kick-in when typing: 0 ms

4. Customize the help Document System

In Settings-> Environment-> Help files, create an entry named man. In the next dialog box, select no, and manually enter man:/usr/share/man in the path below.

Hook default (using the F1 shortcut. In this way, you can use manpage.

Run the following statements on the [terminal] to install the gnu c standard.

Sudo apt-get install manpages-dev // C API

Sudo apt-get install manpages-posix // posix function

Sudo apt-get install manpages-posix-dev // posix develop documents

Sudo apt-get install glibc-doc // C API

Sudo apt-get install libstdc ++ 6-4.5-doc // C ++ API

Sudo apt-get install stl-manual // STL

Sudo apt-get install manpages-zh // Chinese Document

Modify man's default language

Sudo gedit/etc/manpath. config

Copy all rows containing/usr/share/man to the next row and change it to/usr/share/man/zh_CN.

5. Auto-complete full-function settings

For each new Project, choose [Project]> [Properties...] from the menu. -> [C/C ++ parser options] Add the directory where the header file is located, so that the automatic completion and information prompting function can work properly,

The following is the directory of the standard library header file:

/Usr/include

/Usr/include/bits

/Usr/include/c ++/4.3/tr1

/Usr/local/include

/Usr/lib/gcc/i486-linux-gnu/4.3/include

/Usr/lib/gcc/i486-linux-gnu/4.3.3/include

Socket file path

/Usr/include/sys

/Usr/include/netinet

/Usr/include/arpa

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.