How do I use Linux systems to compile and run programs under Windows?

Source: Internet
Author: User
Tags filezilla

Many developers have this question: they usually work under Windows, and their own program is running the environment is Linux, how to switch from Windows to Linux? Do you want to write code specifically to the Linux machine?

In fact, simply installing a software called SECURECRT under Windows and a software called FileZilla can easily solve the problem.

SecureCRT and FileZilla Introduction

SECURECRT is a terminal emulator that supports SSH (SSH1 and SSH2) and is simply the software that logs in to a Linux server host under Windows.

FileZilla is a free open source FTP software, divided into the client version and server version two, with all the features of the FTP software.

Steps to compile and run the program to Linux

Before using SECURECRT and FileZilla, make sure that a Linux-installed machine is running (generally, each development team has a machine dedicated to testing the program, which can install Linux on this machine). The IP address of the Linux machine used by the author is xx.xx.xx.xx, the user name is Zxin10, and the password is yyyy.

First step: Log in to Linux using SECURECRT.

Open the SECURECRT software and enter the IP and username on the interface, as shown in 1.

Figure 1 Login Screen

Then, click on "Connect" in Figure 1, and enter the password in the interface that appears, as shown in 2.

Figure 2 Password Input interface

After the password is entered correctly, it is logged into the Linux system, as shown in 3.

Figure 3 The interface after successful login

In order to compile your own program, we need to create our own file directory, as shown in 4.

Figure 4 Creating a new personal directory

Once the catalog has been established, we can go to the directory and look at 5.

Figure 5 Go to new directory

At this point, "Everything is ready, only the East Wind", the next thing we need to do is to use the FileZilla software to write their own programs written under Windows to pass up.

The sample programs in this article are as follows:


Step two: Upload your code to Linux using FileZilla.

Store the "hello.c" file in the "Test" folder in the D-Drive and start filezilla,6 as shown.

Figure 6 The interface after starting FileZilla

Enter the IP address in "host (H)", enter the "ZXIN10" username in "user name (U)", enter the correct password in "Password (W)", "Port (P)" Can not fill in and use the default value, then log on to the Linux machine. After boarding, go to the "zhouzx" directory, and the "hello.c" file to go up, as shown in 7.


Figure 7 The interface after uploading a file

At this point, the "hello.c" file has been uploaded to the "zhouzx" directory, you can now compile the file.


Step three: Compile and run the program on Linux.

Use the "Gcc-g-O-Hello hello.c" command to compile the file, as shown in 8.

Figure 8 Post-compilation results

As you can see, after the compilation succeeds, there is a "Hello" file generated. Then, run the "Hello" command to see the output of the program, as shown in 9.

Figure 9 Output of the program

The above is to put the program under Windows to Linux to compile and run the entire process. This article is just an example of a simple program, the actual software development projects in the program is much more complex, but the basic operating procedures are similar. Of course, it is also possible to write programs directly under Linux, such as using the VI Editor to write programs. But because of the ease of use, I think it's a little easier to write programs under Windows. According to their own habits and the requirements of the project team to choose a reasonable way to write code.

How do I use Linux systems to compile and run programs under Windows?

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.