Build a C ++ environment for eclipse development in Windows (I)

Source: Internet
Author: User
The environment is JDK + eclipse + CDT + mingw. During this period, many problems were encountered and the online solutions were messy. Therefore, we specially sorted them out for your reference. The software is updated at any time. Please refer to your own version.   1. JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html   Just click Next. x86 has nothing to do with x64. It mainly depends on your system. After installation, confirm the version. My version is jdk6 and 32 bits. The installation process and setting environment variables are very simple and will not be described here. 2, Eclipse: http://www.eclipse.org/downloads/   There are many versions. We recommend that you select this version, that is, the first version. After that, you can not only write C but also write Java: The reason for not selecting the following is that if you have installed eclipse, you will not need to use it ~~~ You must unify the 32-bit or 64-bit data with your JDK. Otherwise, a similar error will be reported: After decompression, you can use it directly to determine your eclipse version. Help-> about eclipse My version is Indigo Sr2 and the latest version is Juno. Well, Juno. 3, CDT: http://www.eclipse.org/cdt/downloads.php   Skip this step if eclipse for C/C ++ is in step 2. It should correspond to your own eclipse version. After the download is complete, it is a compressed package. After decompression, there may be several files in it. There are only two useful files: Features and Plugins. Copy all the content in these two folders to the corresponding folder in the eclipse root directory. If any prompt file is duplicated, overwrite it. An error may occur when you install the plug-in using link. 4, mingw: http://sourceforge.net/projects/mingw/files/ Download the online installation package directly. Although the process is slow, it is safe and worry-free, and this is a loss compared with the android SDK. The installation process is relatively simple. Select the latest version for download: Directly mount the disk to the disk D, so that no problem will occur when you add it to the path. If you do not install the disk C, the system disk size will be reduced: Select the compiler you need. The first two methods are enough. You can only select multiple methods to increase the waiting time for download. The last option is optional. On the one hand, the download time is increased, and on the other hand, the compiler will not be used at all. Then let's wait. I waited for half an hour ~~~~ 200 m after installation. If your network speed is not allowed, it is recommended to download the offline installation package, which will be explained in detail later. The environment variable configuration is installed in D: \ mingw. You can modify it according to your own path:   Create a variable. Other variables reference this variable.
Mingw_path = D: \ mingw
If there are any of the following variables, append them and create them. 4.6.2 is the version number. You can directly view them in the corresponding directory. Note that the variables and variables must be separated by semicolons (;).
Path =
 
% Mingw_path % \ bin;
 
% Mingw_path % \ libexec \ GCC \ mingw32 \ 4.6.2;
 

C_include_path =
 
% Mingw_path % \ include;
 
% Mingw_path % \ Lib \ GCC \ mingw32 \ 4.6.2 \ include

LIBRARY_PATH =
 
% Mingw_path % \ Lib;
 
% Mingw_path % \ Lib \ GCC \ mingw32 \ 4.6.2

Cplus_include_path =
 
% Mingw_path % \ Lib \ GCC \ mingw32 \ 4.6.2 \ include \ c ++;
% Mingw_path % \ Lib \ GCC \ mingw32 \ 4.6.2 \ include \ c ++ \ backward;
% Mingw_path % \ Lib \ GCC \ mingw32 \ 4.6.2 \ include \ c ++ \ mingw32;
% Mingw_path % \ include
  After the configuration, you must rename D: \ mingw \ mingw32-make.exeand make.exe Test mingw: Enter make-V and GCC-V in the command line. Create a hello. c file and a hello. cpp file, and put it in the C root directory. Hello. c file content:
1# Include <stdio. h>2 IntMain ()3 {4Printf ("Hello C");5Return 0;6}

Hello. cpp file content:

   1  # include 
    
     2  
     using  
     namespace  
     STD;  
     3  
     int  
     main ()  
     4  
    { 
     5  cout 
    "  
     Hello C ++  
    "  
     Endl;  
     6  
     return  
     0  
    ;  
     7 }
    

Compile these two files by referring to the command line: AIS the generated a.exe File

So far, mingw installation is complete.

The establishment of the development environment is complete. The next article will share with you how to write in the established IDE environmentCode.

References: 1. mingw set environment variable: http://www.cnblogs.com/DevPlus/articles/2219312.html 2, mingw official offline Installation Method: http://www.cnblogs.com/smartdog/archive/2012/03/30/2425079.html
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.