Detailed Windows Eclipse CDT configuration C/C + + compilation Environment

Source: Internet
Author: User

In fact, Windows, C, C + + IDE, but many of the IDE's UI and user experience basically stay in the last century, in addition to eclipse CDT and Visual Studio, but the latter is now a Big Mac, installation files are more than 3 G, and this cargo installation easy to remove difficult, but Eclipse CDT is not the same, the students familiar with Java Eclipse can quickly adapt ~

1. Installation of Eclipse and CDT

Go to Eclipse's official website http://www.eclipse.org to download eclipse.

Install the CDT offline. The full name of the CDT is C/s + + Developmenttools, a plug-in that enables Eclipse to support C + + development. Go to the CDT official website, HTTP://WWW/ECLIPSE.ORG/CDT, then select a mirror site to download the CDT separately. When the download is complete, unzip the two compressed packages into the Eclipse directory or install them via plug-in mode.

Note: The version of CDT has a strict correspondence with the version of Eclipse, and if the version corresponds incorrectly, the installation will not succeed.

(You can also install the CDT online via Eclipse's software update feature after Eclipse is installed, and you can refer to Eclipse's online documentation for details.) )

If you do not want to toss on the plugin, you can also download the eclipse's officially compiled binary Eclipse CDT directly:

Http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/lunasr2

2, installation Mingw/cygwin

Cygwin is a UNIX-like environment for Windows that includes GCC porting and all the necessary development tools, including the Automake and GNU Debugger (GNU Debugger,gdb). Cygwin is built on the basis of the Cygwin1.dll library. Cygwin's alternative solution is minimalist GNU for Windows (MinGW) (see Resources for links). The tool is a set of Windows-specific header files and import libraries that are freely available, free to distribute, and are combined with the GNU toolset, which allows you to generate native Windows programs that do not rely on any third-party DLLs. If you want to create a POSIX-compatible Windows application, then MinGW is the best choice. MinGW can even work on Cygwin installations.

The eclipse CDT is not yet able to compile and execute C + + programs because of missing important parts. This part is the compiler for C/s + +. Under Windowsos We can choose MinGW (Cygwin also can). To MinGW's website http://mingw.sourceforge.net, download MinGW, install. After installation, configure some environment variables.

3. Add Environment Variables

Right-click My Computer, properties, high-level environment variable, add to system variable

Mingw_home=c:/mingw

Library_path =%mingw_home%/lib

C_include_path =%mingw_home%/include

Added at the end of the path variable;%mingw_home%/bin

CygWin Ibid.

4, configuration MinGW

Because the eclipse presets are used to compile files for Make.exe, the file name of MinGw after installation is Mingw32-make.exe

So we need to rename Mingw32-make to make.

After installation, the environment variable may be set up automatically during the installation process, enter the GCC test in cmd, if the display gcc:no input file, the installation is successful, otherwise, the C:/mingw/bin directory manually added to the environment variable (path) inside.


5. Configuring Eclipse

In order for the CDT to be compiled with MinGW, it needs to be set in Eclipse

Window->preferences->c/c++->make->newmake project->new Builder

->binary Parser Cancel Elf Parser re-election PE Windowsparser (or CYGWIN/MINGW)

6. Create, compile, C + + engineering

Create a new->managed make cproject-> to write the project name, and then under the project "SourceFile", with the name arbitrary, with the extension. C.

7. Frequently Asked Questions:7.1 Launch failed no binaries error

Windows > Preferences > C + + > New CDT Project Wizard > Makefile Project > Binary parsers

A) Set it to Windows PE Parser if is on Windows.

b) Set it to Cygwin PE Parser if you is using Cygwin

Windows > Preferences > C + + > Build > Environment

Now click on the "select" and select "Path" variable So, you add the path variables in Eclipse.

If all of the above operations are complete, you can CTRL + B (compile the project), then CTRL + F11 (run the project)

7.2 Run, there was a baffling rush.

This situation is generally your CYGWIN/MINGW compilation environment installation is not perfect/version of the problem caused, you can change another IDE environment or re-complete installation test, I choose to install C-free 5, it comes with a set of MinGW environment, Reset the previous three environment variables to point to the MinGW of C-free 5 and retry everything ok~

7.3 When the CDT plugin is installed, C, C + + projects cannot be found in the Eclipse New Project Wizard

The issue will be resolved because the CDT version does not match the Eclipse version and the appropriate CDT version is replaced.

8. Code Run Example:
#include <stdio.h> #include <stdlib.h>int main () {char c;printf ("%s", "Please input a char:\n"); Fflush ( STDOUT); scanf ("%c[\n]", &c); char c2ascii = Toascii (c) + 35;printf ("The original char is:%c, and the convert char is: %c\n ", C, C2ascii); return 0;}

9, Refer:

[1] Detailed windows Eclipse CDT configuration c-c++ Compilation environment

http://blog.csdn.net/jason314/article/details/5639334

http://blog.csdn.net/chaofanwei/article/details/11841621

[2] using the Eclipse platform for C/D + + development

http://www.ibm.com/developerworks/cn/linux/opensource/os-ecc/#resources

[3] Launch Failed Binary not found eclipse for C in Windows

Http://stackoverflow.com/questions/9407430/launch-failed-binary-not-found-eclipse-for-c-in-windows

[4] Launch Failed. Binary not found. CDT on Eclipse Helios

Http://stackoverflow.com/questions/4971926/launch-failed-binary-not-found-cdt-on-eclipse-helios

Detailed Windows Eclipse CDT configuration C/C + + compilation Environment

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.