Acknowledgment: Tinyfool's martial arts help! CDT is a plug-in to write C programs in Eclipse, although it is not perfect, but is a good way to write Linux under Linux in Windows. According to the requirements of Eclipse's official website, you should download the following Dongdong: 1. Eclipse (http://www.eclipse.org/downloads/index.php), I am 3.0, there is a higher version, if If you want to have Chinese help, you can download version 2.1.2, I will put two all, see help in 2.0, in 3.0. 2. Download CDT 2.0.2 (http://download.eclipse.org/tools/cdt/releases/new/), the version of the CDT is also a lot, pay attention to the download and your Eclipse match, support Eclipse 3.0 CDT 2.0 .2 is not very mature, so don't give it directly in the CDT main version download page, you can download it in the URL I. 3. Download MINGW, what is your own to check it online, anyway, there must be. But it is not easy to find online (the official website can't connect), I have a good man to do it, go up with my server: http://2peak.bosaga.com/other/mingw.exe, then install. 4. Suppose your mingw is installed in the c: / mingw directory, set PATH = C: / mingw / bin in the environment variable; this sentence must be placed in front, preventing the Make command conflict with the VC / .NET, And change XXX-Make.exe in the C: / Mingw / Bin directory to make.exe. Then in the CMD, execute make.exe if it is "*** no targets specified and no makefile found. Stop." That's right. 5. Install Eclipse, decompress it, don't need any installer (really green). 6. Unzip CDT, two folders: Features and Plusins, copy the Dongdong in the folder to the directory corresponding to the Eclipse. 7. Start Eclipse now, then see if there is a C / C Engineering Guide in File-> New-> Project? If so, congratulations! If not, don't worry, because you have met me. 8. In Help-> Software Updates-> FIND AND INSTALL ..., select Search for New Features To Install, then click the New Remote Site button, add the following address: http://update.eclipse.org/toOLS/CDT / releases / new, then select it, Eclipse will find new CDTs, wait for a while, list the version of the CDT, select the latest, then next, it will start downloading and installing from the Internet, installed The Eclipse will be reminded later.
9. Get it, see the C, C Engineering Wizard in the figure! Test if your compiler and make programs work properly. Create a new MAKE C Project (automatically generate makefile), then create a Class file or use the HelloWorld example. My file is as follows: --------- myclass.h --------- # i dDef myclass_h # define myclass_hclass myclass {public: int show (); myclass (); virtual ~ myclass };
#ENDIF // MyClass_H
-------- Myclass.cpp -------- # include "myclass.h" #include "iostream"
Using namespace std;
Myclass :: myclass () {} myclass :: ~ myclass () {}
INT myclass :: show () {cout << "Hello World!" << endl; return 0;
INT main () {MyClass T; T.Show (); return 0;} 10. Save program, automatic compiler if there is no error to generate an Exe program in Debug. 11. Then click the Run button on the toolbar, as shown, and create a new run configuration for the project.
12. The result is displayed in the Console window, as shown.