Configure the Linux programming environment

Source: Internet
Author: User

Recently, I started to use Linux programming. In the past, I only had the C ++ programming basics for Windows, and I was very unfamiliar with Linux. Therefore, I learned everything from scratch.

To do well, you must first sharpen your tools. The development environment is very important. A good development environment will bring a lot of convenience to programming. I need to write a network program, so my configuration is as follows:

 

1. A Windows 7 operating system is installed on the computer, and you don't have to worry about buying a genuine system from your laptop. We recommend that you develop it on XP, but I don't think it will affect much.

 

2. Because it is a network program, at least two computers are required. With limited conditions, I installed a vmwarevm on Windows 7 and used the VM to simulate another computer.

 

3. to install linux on a virtual machine, I chose the Ubuntu Linux desktop version (although it is unnecessary to bring a graphical interface and it is much larger, there are ready-made images on hand, ). It took me some time to connect to the Internet. When you install the system on a virtual machine, a message is displayed, indicating that you select network adapter and bridged.

After the installation is complete, go to the system and open the terminal. I think it is like CMD in windows. No matter which user you are using, it is best to switch to the root user if you are not familiar with Linux, because this user has the maximum permission and will not cause your operation to fail because you do not have the permission.

The root user is not enabled in Ubuntu by default. Therefore, you need to perform the following operations:

Command: sudo passwd Root
Prompt to enter the password of the current user
Then prompt to enter the Unix Password
Then, the system prompts you to repeat the Unix Password.
Steps 2 and 3 are to set a new password for the root user.
Then you can enter the command su root to enter the root user.

Linux Network Configuration:
Modify the/etc/Network/interfaces file with the following content:
Auto eth0' the eth0 is automatically loaded when the system starts.
Iface eth0 Inet static 'indicates static Configuration
Address 192.168.0.110 'configure the IP address as 192.168.0.110
Gateway 192.168.0.1 'configure the default gateway as 192.168.0.1
Netmask 255.255.255.255.0 'configure the subnet mask 255.255.255.0
# Network 192.168.0.0 'configure the network number
# Broadcast 192.168.0.255 'configure the broadcast domain
Sudo/etc/init. d/networking restart application configuration file

The above information is based on my network configuration. After the configuration is complete, you can try to run Ping www.baidu.com. If yes, the configuration is correct.

However, the premise is that the windows system of the virtual machine can be pinged.

 

4. Install the C/C ++ compiling environment. You only need to run a few commands.

Apt-Get install libc6-dev download header file

Apt-Get install build-essential download toolkit, including GCC, G ++, binutils, make

Apt-Get install GDB download Debugger

Apt-Get install indent download C program beautify

Apt-Get install lint download program checker

Apt-Get install manpages-dev download and install the complete man Manual

The above command is actually divided into two steps, Apt-Get indicates to download install indicates to install.

 

5. Use VI as an editor in Linux. Writing code is not very comfortable. Without Vs + va, I still like to write code in the Vs + va environment. Therefore, you need a tool to upload the written code to the compilation link in Linux. I chose sshsecureshellclient. This tool has two important modules: SSH Secure Shell client, which can be remotely logged on to Linux. The displayed interface is like terminal in Linux; you can execute commands in this file. One is the SSH Secure File Transfer client, which allows you to upload and download files through the graphic interface. Sshsecureshellclient is installed on Windows. Therefore, a corresponding SSH server needs to be installed on Linux. Run the command: APT-Get Install SSH. Linux will automatically download and install it and start the SSH service.

 

I think the basic environment I need is ready. The next step is to start code writing and debugging.

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.