9.9 engineering documents

Source: Internet
Author: User

9.9 engineering documents

in the previous section, we have talked about a program in C Language that can be composed of multiple source files, each source file can contain multiple functions. How can these multiple source files form a program and how can they be assembled? This section describes how to create and use a project file
first, how to create a project file? There is a project in the main menu of TC. You can create a project file by using this menu item. A project file is a text file whose content is the program file name to be assembled. When creating a project file, you must first customize the main file name of a project file. The extension given by the system is. prj. First, determine which programs will form a project file, such as the source file file1.c, file2.c, and file3.c. The three source files generate an executable program try.exe. The specific process is:
(1) edit the project file. You can use the editing software or the TC environment. Select "LOAD" under "file" in the TC menu, and enter the file name of the project file in the dialog box, which is assumed to be: Try. prj
(2) in the editing window of TC, enter file1.c, file2.c, and file3.c. If the three files are not in the default path, the path must be added before the file name. Save with F2. So far, the project file try. prj has been built.
note: the files file1.c, file2.c, and file3.c contain different functions. However, only one file can contain the main function main (). Regardless of the source file to which the program is stored, the program starts to run from main.
(3) under "project" in the TC main menu, select "project name" and enter the project file name, that is, try. prj.
(4) Compile the source program. Because the project file is used, the compilation system compiles each source file according to the source file name listed in the project file. After the compilation is successful, the corresponding target file. obj is generated.
after the three source files are compiled,
file1.obj
file2.obj
file3.obj
(5) connects to each target program, generate the execution program.. In the operating system, run try to obtain the corresponding running result.

Example 9-32: Use of project files.
/* File 1: file1.c */
F ()
{Printf ("This is the first program/N ");
Ff ();/* call another function ff ()*/
}
/* File 2: file2.c */
Main ()
{Int I;
For (I = 0; If ();/* calls the function f ()*/
}
/* File 3: file3.c */
Ff ()
{Printf ("this is the second program/N ");
}
Project File Name: Try. prj
Project File Content: file1.c
File2.c
File3.c
Run the program name try.exe after the connection is compiled.
Running result: This is the first program
This is the secend Program
This is the first program
This is the secend Program
This is the first program
This is the secend Program

This article is transferred from
Http: // 202.113.32.136/jsjjp/class_online/right1009.htm

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.