logo资料库

Eclipse CDT使用说明.pdf

第1页 / 共41页
第2页 / 共41页
第3页 / 共41页
第4页 / 共41页
第5页 / 共41页
第6页 / 共41页
第7页 / 共41页
第8页 / 共41页
资料共41页,剩余部分请下载后查看
Eclipse Project CDT (C/C++) Plugin Tutorial 1, 2 By Brian Lee Department of Computer Science, University of Manitoba, Winnipeg, Manitoba, Canada Last revised: February 20, 2004 Overview: This tutorial describes the installation of the Eclipse Project CDT (C/C++ Development Tools) plugin on the Windows platform (running under Linux is mentioned at the end of this tutorial). It describes the entire installation process in detail and is intended for developers who are familiar with the Eclipse environment and would like to develop C/C++ applications in this environment. As a result, it has been assumed that Eclipse has already been installed and that the developer has a basic understanding of how to use Eclipse. To learn more about the Eclipse Project, please visit: http://www.eclipse.org In addition, this tutorial is especially useful for students who are uncomfortable writing C/C++ applications in a UNIX or Linux console environment. By using the Eclipse CDT plugin, students can develop C/C++ applications within the Eclipse IDE which provides an intuitive GUI for development. As well, applications developed this way require minimal effort in porting to a UNIX or Linux environment. Requirements: This tutorial has been written in a Windows XP Professional environment, satisfying the following requirements: Java 2 SDK v1.4.1 Eclipse v2.1 MinGW v3.0.0-1 CDT v1.1.0 GA 1 This work was funded by an IBM Eclipse Innovation Grant. 2 © Brian Lee and David Scuse Department of Computer Science University of Manitoba Tutorial 7 – Page 1 CDT (C/C++) Plugin www.cs.umanitoba.ca/~eclipse
For instructions on how to install Eclipse, please refer to the following document: http://www.cs.umanitoba.ca/~eclipse/1-Install.pdf Links to downloading MinGW and the Eclipse CDT plugin will be mentioned later in this document. Installing and Setting Up MinGW: In order to be able to compile C and C++ source code using Eclipse, it is necessary to install a C/C++ compiler for Windows. There are several C/C++ compilers available for Windows but MinGW has been selected for this tutorial due to its easy installation and configuration. MinGW is based on GNU toolsets and provides the header files and libraries needed for C/C++ development. At the time of writing this tutorial, the latest version of MinGW that has been tested to work properly with the Eclipse CDT plugin is version 3.0.0-1. To download MinGW, please visit the following site: http://sourceforge.net/projects/mingw/ Click on the Released: MinGW-3.0.0-1.exe link. Department of Computer Science University of Manitoba Tutorial 7 – Page 2 CDT (C/C++) Plugin www.cs.umanitoba.ca/~eclipse
Click on the link to download the file to your system. Once the download is complete, locate the file on your system and double-click on the file to begin the installation of MinGW. 1.) Click Yes to continue with the installation of MinGW. Click Next to continue. 2.) Click Yes to accept the License Agreement. Department of Computer Science University of Manitoba Tutorial 7 – Page 3 CDT (C/C++) Plugin www.cs.umanitoba.ca/~eclipse
Note: Unlike other ports of GCC to Windows, the runtime libraries are not distributed using GNU's General Public License (GPL). You, therefore, do not have to distribute your source code with your programs unless, of course, you use a GPL library in your programs.3 3.) Click Next to continue. 4.) Install MinGW to the following directory: C:\MinGW\ Note: If you install to another directory, remember the directory you install to as it will be used later in this tutorial to complete the installation of the plugin. 3 Taken from: http://www.mingw.org/mingwfaq.shtml Department of Computer Science University of Manitoba Tutorial 7 – Page 4 CDT (C/C++) Plugin www.cs.umanitoba.ca/~eclipse
5.) Click Install to continue. The following screen shows the progress of the installation. MinGW installs a number of GNU GCC and binutils projects, including GDB which is very useful in debugging your C/C++ applications. Department of Computer Science University of Manitoba Tutorial 7 – Page 5 CDT (C/C++) Plugin www.cs.umanitoba.ca/~eclipse
6.) Click Finish to exit the setup of MinGW. 7.) In order for your system to recognize the MinGW executables from any directory without having to type the full path of the command, the PATH variable needs to be modified: a. Click on Start Control Panel. b. Double-click on System. c. Click on the Advanced tab and then Environment Variables. Department of Computer Science University of Manitoba Tutorial 7 – Page 6 CDT (C/C++) Plugin www.cs.umanitoba.ca/~eclipse
d. Select Path under the System Variables section and click on Edit. e. Assuming that MinGW has been installed to C:\MinGW, add the following to the end of the Variable value: ;C:\MinGW\bin Note: The semi-colon is used to separate different directories for the PATH variable and must precede the pathname C:\MinGW\bin. Also, please make sure that there are no spaces between the semi-colon and the path name! f. Click OK, then OK, and OK again to apply the changes. 8.) To verify that the installation of MinGW is successful and that the PATH variable has been changed correctly, perform the following steps: a. Click on Start Run … b. Type cmd into the dialog box and press OK. c. Type the following into the command prompt and then press ENTER: gcc –v Department of Computer Science University of Manitoba Tutorial 7 – Page 7 CDT (C/C++) Plugin www.cs.umanitoba.ca/~eclipse
d. If the output of the above command is similar to the screen shown below, then you have successfully installed MinGW and changed the PATH variable: e. If the output of the above command is similar to the screen shown below, this means that the PATH variable has not been changed successfully. Follow the instructions carefully on the previous pages to change the PATH variable: 9.) After verifying that MinGW has been installed and that the PATH variable has been changed successfully, you are ready to install the Eclipse CDT plugin. Installing the Eclipse CDT Plugin: Now that your system is ready to compile C/C++ applications, download the Eclipse CDT plugin at the following site: http://www.eclipse.org/cdt/ Department of Computer Science University of Manitoba Tutorial 7 – Page 8 CDT (C/C++) Plugin www.cs.umanitoba.ca/~eclipse
分享到:
收藏