Compiling C + + through Cygwin on eclipse

Source: Internet
Author: User

Introduction

Before writing C + + has been written in Microsoft's Visual Studio, feeling integrated high really cool.
Recent internship requirements on Linux running a network control background, if you use the Windows-oriented compiler, written code may not be able to run on Linux, so need to use Cygwin.
Cygwin plainly is built on the Linux environment on Windows, with the Cygwin environment to run successfully, on a real Linux system compiled and run will not have some weird problems.
And the reason to use eclipse is nothing more than a good expansion, Eclipse is the equivalent of a board, itself and no egg use, but loaded with a variety of plug-ins will be able to do anything.

Installation steps
    • Install the JRE, because Eclipse itself is written in Java and requires a JRE to run Java. The JRE on the Baidu a search on, and occasionally will update, here is not posted.
  • Note that the installation path of Eclipse does not have Chinese characters, preferably not a space, the delimiter is underlined "_".
    Actually installs the software should form the custom, the path all is the English + the numeral + underline combination, so regardless of which kind of encoding format, can correctly read the path.

  • In addition, because running eclipse is bound to run the JRE, and the JRE occupies a large amount of running memory, so if the computer configuration is not very good, run eclipse do not open too much software at the same time, card.

    • To install Eclipse:

http://pan.baidu.com/s/1hsoAopm

The installation package for Eclipse is just a boot program that requires an Internet connection to download the installation. Install select Eclipse for C + + Developer.

    • Installing the Cygwin:

Http://pan.baidu.com/s/1mi7yV0G

The above link is just Cygwin installation program, it needs a lot of package to operate, installation, choose Downlaod from the Internet, domain name selection mirrors.ustc.edu.cn, search make packages, click Default, Make it install, and then click Next in the lower right corner.
Once the installation is complete, run Setup again, and install the g++ package as you do. Run again to install the GCC package.

    • Add the path to the Cygwin in the system environment variable, with the following details:

Right click on the left side of the "Advanced system Settings", "Environment variables", and the "system variables" below the right----Properties-------------

    • Open cmd, input gcc-v and make-v, if there is a return output indicating that the installation is successful, if you are prompted that GCC is not a valid command and so on, check the environment variables are not set to, there is no English semicolon separated and so on.
Compile execution steps
    • Open Eclipse, set the workspace first, this is your code, compile the results of files such as the storage path
    • C + + Project, File-New
    • Enter project name, select Empty Project, toolchain use Cygwin GCC

    • Click Finish to finish

    • Create a new. cpp file in the project and enter the most basic HelloWorld code.
    • Project-Build All
    • Run, run
    • In the console window below you can see the output of the program, just like the previous console small black box, but now is the white →_→

If there is no console window below, click Windows, Show view, console to see

Compiling C + + through Cygwin on eclipse

Related Article

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.