Software development tools (Chapter 9: Using Eclipse for C / C ++ Development)

First, install MinGW

MinGW refers to the build environment used to generate an executable file, which is the development of C / C ++ project toolset. To be able to compile and run Eclipse CDT C and C ++ program, it must be installed a C / C ++ compiler.

Download: https: //sourceforge.net/

Second, the first C / C ++ project

C language is a process-oriented computer programming language. It has a high-level language features, but also has assembly language features. It is one of the many computer languages ​​recognized as a fine structure of programming languages

C New Project:

File (File) → New (New) → Project (Project) → C Project; select the C language-related attributes in C Project window. Enter a project name in the Project name (Project name) tab.

In the Basic Settings window, you can set annotation part of the source code. Are typing in the Author (Author), Copyright (Copyright notice) and other tab, click the next button.

In the Select Configurations window you can select the debug and release folders and advanced settings, keep the default settings, click the Finish button to create a new C Project, will be saved to write source code and configuration files in this project.

New Source Folder (focus, memory, application)

Right-click Explorer in the new project → Select New (New) sub-menu of the source folder (Source Folder) option

Enter a folder name, position the cursor to the file name (Folder name) in the input source folder name (typically src) → Finish

New C ++ Class (focus, memory, application)

Right-click the src folder and select New → (New) sub-menu of the class (Class) Options → enter the class name → Finish

Upon completion, Eclipse CDT automatically generates HelloWorld program, which is a .c file, then you want to compile it into an .exe file that can be run.

Compile the C program (focus, memory, application)

Right-click New Project → Build Configurations → Build → All

After successful compilation you will see the Release folder, containing just the compiled executable file in Explorer.

Run C program (focus, memory, application)

In Explorer, right-click New Project Settings → select Run (Run Configurations) in operation mode (Run As) submenu

In Create, manage, and run configurations window, click New Run Configuration (New launch configuration) button to create a run configuration.

After entering the new window, select the Release Build configuration options, click Search Project button set. After all the settings, click Run.

Use the Browse function (focus, memory, application)

Eclipse provides a set of tools for C / C ++ programmers to facilitate program development. Among them, use the browse function to quickly locate and view from multiple angles to each element of a program, including the hierarchical structure of the code, calling relationships, inheritance and so on.

 

 

Eclipse is defined in the namespace, class, structure, as the variable (element).

 

Third, the use Eclipse refactoring

Use Eclipse reconstruction function, the user can change the code range of the system without affecting the operation of the program.

Renaming variables (memory, applications)

Rename function Eclipse Remodeling solve all the problems variables, classes, functions, and so renamed.

Select variable → Click reconstruction (Refactor) menu bar → select Rename (Rename) → fill out a new variable name → OK button

Extraction method (memory, applications)

Snippet extracted repeatedly appears in the program formation method, can greatly reduce the length and increase the code readability and ease of maintenance, while such method call becomes clear and simple.

Selected code segments, right click on a selected portion of the pop-up menu → select reconstruction (the Refactor) extracting method (Extract Function) in the sub-menu in the popup window → enter the name of the method the Next button →

Extraction constants (memory, applications)

Extracting the essentially constant digital program, characters and the like is defined as a constant, such that call and modify the constant becomes simple.

Selected constant, right click on a selected portion of the pop-up menu → select reconstruction (the Refactor) extraction constants (Extract Constant) at the input name of the constant sub-menu → → the Next button to open the window in the text box

Fourth, use the search function

Use the Find / Replace method (memory, applications)

Edit (Edit) → Find / Replace (Find / Replace)

Use the Search menu to search (memory, applications)

In Eclipse CDT unique Search function, you can execute files, tasks, and C / C ++ search function. Search Menu → Search Options

Guess you like

Origin www.cnblogs.com/jalja/p/11665490.html