Precautions for using DEV C++ to create a project

There are two ways to organize multiple subprogram files in the project

1. File inclusion method

① the main program with all the best routines are placed in the same file folder, so that only a few more lines in the main file
#include "sub-file name (including extension)";
note that the file name to be exactly
② If the main If the program and the subprogram are not in the same folder, you need to write the absolute path
#include "disk name:\a folder\subfile name"
③Pay attention to the sequence of the macro definition and the subprogram inclusion statement in the main file, and be sure before using the macro definition Declare first

2. Project file method

Method:
①Build the project: start DEV-C++, execute the "file" "new" "project" command, and click the "Console Application" option in the Basic tab of the new project dialog box, as shown in Figure 10.1. Write the project name in the "Name" box, such as exp10. Select "C project", click the "OK" button, select the save path in the pop-up window, and click the save button to generate a project file with the extension dev.
②Add files. Right-click the project name in the left window, a shortcut menu appears, select the "Add" command to add the required subroutines to the project (hold down ctrl and click the file to select multiple).
Note that at this time, there is no need to include subroutine statements in
the main program. ③All the header file declarations, function declarations, macro definitions, etc. required by the main program and subprograms are written into a header file (because the project file method is for each source The programs are compiled separately and then combined, so each subprogram needs to have its own declaration) Right-click the project name in the left window, a shortcut menu appears, select the "new file" command to write all declarations into the file, Save to the project directory, and select the type "head file.h" (refer to 1.①② for the relationship between the general declaration file and the subroutine)

Guess you like

Origin blog.csdn.net/kyc592/article/details/110918129