Trubo C command line compilation connection

Source: Internet
Author: User
Tags dbase exit in home screen line editor wordstar

Before reading this article, I will first describe how to install and use C language:
After downloading Turbo C 2.0 and Turbo C ++ 3.0, many netizens asked me most about the following problems during use:
1) The include files such as stdio. h conio. h cannot be found;
2) Cos. OBJ cannot be connected.
These problems are caused by the absence of a set path. Currently, the downloaded TC2 and TC3 are classified into two versions by installation: first, install the TC2 and TC3, which should have already been configured with the path; second, directly decompress the package and establish TC. EXE shortcut, double-click in Windows to run (DOS directly run TC. EXE). Currently, most of them are in China. (because I recommended the English version of TC2 that I uploaded to my 269 network home to more than 10 software sites in the previous section), please pay attention to the path settings before downloading and using it:
Set to: Option-> directories:
Include: [TC2/3 Directory]/include
Lib: [TC2/3 Directory]/lib
Set a working directory for the output directory to avoid mixing.
Note that the change Dir (Change current directory) in files should be set to the directory where the current program is located.

(The following documents are recommended by a friend. Thank you)

I. Origins of C Language

C language was designed and invented by Dennis Ritchie of the United States in 1972.
Is used on the DEC PDP-11 computer. It consists of the early programming language BCPL (Basic Combind
Programming Language) has evolved. In March 1970, Ken of the at&t Bell lab
Thompson designed a more advanced language named B Based on BCPL, and finally introduced the advent of C language.
With the increasing popularity of micro-computers, many c-language versions have emerged. Because there is no unified standard,
This makes some inconsistencies between these C languages. To change this situation, American National Standards
The Institute (ANSI) has developed an ANSI standard for the C language and has become the current C language standard.

Ii. Features of C Language

C language has developed so rapidly and has become one of the most popular languages, mainly because it has powerful
Function. Many well-known system software, such as DBASE ⅲ plus and dbase iv, are written in C language.
Using C language with some assembly language subroutines can better display the advantages of C language, such as PC-dos,
WordStar is written in this way. C language has the following features:
1. c is an intermediate language
It combines the basic structure and statements of advanced languages with the practicability of low-level languages. C language can be like
The assembly language performs operations on the same position, byte, and address, and these three are the most basic work units of the computer.
2. C is a structured language
The distinctive feature of structured language is the separation of code and data, that is, each part of the program is not only necessary
Information exchange is independent of each other. This structured method makes the program layers clear, easy to use, maintain, and adjust
Try. The C language is provided to users in the form of functions. These functions can be conveniently called and have a variety
Loop and conditional statements control program flow direction, so that the program is fully structured.
3. Complete C language functions
C language has a variety of data types, and introduces the pointer concept, can make the program more efficient. Another
The external C language also has powerful graphics Functions and supports multiple monitors and drives. And computing functions and logic
The judgment function is also powerful and can be used for decision-making purposes.
4. Wide application of C Language
C language also has a prominent advantage: it is suitable for a variety of operating systems, such as DOS, UNIX, and also suitable
Multiple models.

Iii. Turbo C Overview

1 generation and development of Turbo C

Turbo C is a product of Borland Corporation in the United States. Borland Corporation is specialized in software development,
Developed by a large company. The company has successively released a set of Turbo software, such as Turbo BASIC and Turbo
Pascal and Turbo Prolog are very popular among users. The company launched turbo for the first time in 1987
The C 1.0 product uses a completely new integrated development environment, that is, a series of drop-down menus,
The integration of text editing, program compilation, connection, and program running greatly facilitates program development. 1988
Borland also launched the turbo c1.5 version, adding graphics libraries and text window function libraries.
Turbo C 2.0 was published by the company in 1989. Based on the original integrated development environment, Turbo c2.0
The error checking function is added and can be directly generated in tiny mode. com (data, code, and stack are in the same
64 K memory) file. It can also simulate a mathematical co-processor (8087/80287/80387 supported.
Borland later launched the object-oriented program package Turbo C ++, which inherits the development
The integrated development environment of Turbo C 2.0 contains basic object-oriented ideas and design methods.
In 3.0, Borland added the Turbo
C ++ has been updated, that is, Borlandc C ++, a new generation of Turbo C, has also been released.

2 Basic Configuration Requirements for Turbo C 2.0

The Turbo C 2.0 can run on IBM-PC series microcomputer, including XT, at and IBM compatible machines. In this case
Supported by DOS 2.0 or later, and requires at least k ram, which can be on any color, monochrome 80-column Monitor
Run. Supports the mathematical coprocessor chip or floating point simulation, which will speed up program execution.

3 Introduction to Turbo C 2.0

The Turbo C 2.0 has six low-density floppy disks (or two high-density floppy disks ). Next, let's take a look at the main article about Turbo C 2.0.
Brief Introduction:
Install. EXE installer file
TC. EXE integrated compilation
Configuration setup for tcinst. EXE integrated development environment
Tchelp. Tch Help File
Thelp. com reads the resident program of tchelp. Tch.
Readme information file on Turbo C
Tcconfig. EXE configuration file conversion program
Make. EXE project management tool
TCC. EXE command line compilation
Tlink. EXE Turbo C series Connector
Tlib. EXE Turbo C series library management tools
C0 ?. OBJ startup code in different modes
C ?. Library running in different lib Modes
Graphics. Lib graphics library
EMU. Lib 8087 simulation Library
Fp87.lib 8087 Library
*. H Turbo C header file
*. BGI different display graphics drivers
*. C Turbo C routine (source file)
Where: The above? They are:
T tiny (micro Mode)
S small (small Mode)
C compact (compact Mode)
M medium (medium mode)
L large (Large Mode)
H huge (massive Mode)

[[Description of four important documents

1. TCC. EXE and TC. exe

The Turbo C package has two compilers: TC. EXE in the integrated development environment and TCC. EXE in the command line mode.
The integrated development environment includes: Integrated Editor, command line compiler, connector, and debugger.

Trubo C command line compilation connection
Command Line compilation refers to calling the tcc.exe program of trubo CIN dos. to complete the compilation and connection of the Turbo C source program. when you select the suffix *. during compilation of ASM assembler files, TCC must call tasm before the suffix is. ASM files are compiled. This method is suitable for the compilation connection of C program and assembly language mixed programming. When C program is embedded in assembly instructions, it must also be compiled and connected using this method.
The command line compilation format is:
TCC [option 1 option 2...] file Name 1 file name 2... the options are the options used to connect to the subsequent files. The optional common options are as follows: each option is preceded by a "-" number and case sensitive. The file name refers to the source file. C or the target file. OBJ or library file. when the Lib does not specify that only compilation is not connected, TCC completes the compilation and connection steps. the LIB Library only performs formal connections, and the standard library users do not need to connect.
For example:
TCC-IB:/include-LB:/lib-Etest start. C body. OBJ contains (given by-test ).
-IB:/include indicates that the path of the file to be included is B:/include.
-IB:/lib indicates that the path of the library file is B:/lib.
For example:
TCC-MS-efile-LC:/TC/lib file1 file2.obj graphics. Lib
-Ms indicates selecting the small memory mode for compilation. It is also the default compiling mode of Turbo C. It compiles file1 and then connects file2.obj and graphics.libto generate the executable file of file.exe. graphcis. the path of the Lib library is C:/TC/lib, which means to search for graphics in the C:/TC/lib directory. lib file. for mixed programming, if the assembly program s3.asm already exists, its command line can be written
Tcc ic:/TC/include-LC:/TC/lib-mm S1 S2 s3.asm mylib. Lib
Compile. during compilation, find the inclusion file in the C:/TC/include directory
C: Find the library file mylib. Lib in the/TC/lib directory.

TCC help:
Turbo C version 2.0 copyright (c) 1987,198 8 Borland International
Syntax is: TCC [Options] File [s] * = default;-X-= Turn switch X off
-1 80186/286 instructions-a disable non-ANSI extensions
-B compile via assembly-C allow nested comments
-Dxxx define macro-exxx alternate extends er name
-G generate for speed-ixxx include files directory
-K default char is unsigned-LXXX libraries directory
-M generate Link Map-N check Stack Overflow
-O optimize jumps-s produce Assembly output
-Uxxx undefine macro-Z optimize register usage
-A generate word alignment-C compile only
-D merge duplicate strings-exxx Executable File Name
-F * floating point emulator-f87 8087 floating point
-GN stop after N warnings-in maximum identifier length N
-JN stop after N errors-K standard stack frame
-Lx pass option X to linker-MC compact model
-Mh huge model-ml large Model
-Mm Medium Model-MS * Small model
-MT tiny model-nxxx output file directory
-Oxxx object file name-P Pascal CILS
-R * register variables-u * underscores on Externs
-V source level debugging-W enable all warnings
-Wxxx enable warning XXX-w-xxx disable warning xxx
-Y produce line number Info-zxxx set segment names

2. tlink. EXE is the connection program.

What is an OBJ file?
The content of the target file is the code that completes a certain function, but the machine code that is stored.
It can be understood that the target file is a subroutine or subfunction.
What is the role of tlink.exe?
Connect the startup Code (which is also an OBJ file, responsible for setting the environment, calling the main function, and so on) + the OBJ used by the OBJ + main function where the main function is located to generate the EXE file.

3. tlib. EXE is a tool used to operate lib files.

What is the Lib file?
Object collection, you can use tlib.exe to retrieve the object OBJ from the Lib file, add the object OBJ to the Lib file, and perform other operations.

4, *. h file

The include folder contains the description of the library functions provided by Turbo C.
If you want to use a function, you need to include the corresponding header file.
Of course, you can define your own header files.

5. Set the path

Set the include and Lib paths under options/directories in the TC integrated development environment.
You can edit the turboc. cfg file by using the command line editor)

[[[5. Build your own editing Environment

This process is actually to understand the C language compilation and connection process of Turbo C, and to deepen the understanding of compilation, connection, OBJ and Lib.
Create a new folder (if you want to use it later, copy it from TC)
1. Use the edit editor provided by DOS
2. Use TCC as the Compiler
3. Use tlink as the connector
In fact, other files, such as c0s. OBJ, CS. Lib, are still needed.
Example: Compile and connect a. c.
Compile: TCC-c a. C // compile only a. C to generate a. obj.
Connection: tlink c0s a, a, CS // connect the startup code with the code of a. Some code in CS. Lib is also required in this process.

Tcc a. C can also be used to complete the compilation connection at the same time.
Note: when using the graphics library, you need to display the graphics. Lib input, for example, tcc a. C graphics. Lib.

Write a program to see if it can be compiled and the connection is successful?
You can try

[[[6 Description
To those who started learning C Language
Part 1, 2, and 3 are taken from the online materials
Recommended articles: http://www.3800hk.com/Article/cxsj/cjing/jcjccj/2005-08-06/Article_18835.html

Iv. Install and start Turbo C 2.0

The installation of Turbo C 2.0 is very simple, as long as the 1 # disk is inserted into drive a, in the DOS "A>" Down key
Inbound:
A> install
Now, three options are displayed on the screen:
1. Create a new directory on the hard disk to install the entire Turbo C 2.0 system.
2. Upgrade Turbo C 1.5.
Such installation will retain the original settings for the selection, color, and edit function keys.
3. Install Turbo C 2.0 for a system with only two floppy disks and no hard disk.
Here we assume that the installation is based on the first option, as long as the installation process prompts the disk number, in order to insert
Install each floppy disk smoothly. After installation, a TC sub-object will be created under the C-drive root directory.
Directory. Two directories lib and include are created under TC. The LIB sub-directories store library files and include
All header files are stored in the subdirectory.
When running Turbo C 2.0, enter TC in the TC subdirectory and press enter to enter Turbo C 2. 0.
Integrated development environment.

V. Use of the integrated development environment of Turbo C 2.0

After entering the integrated development environment of Turbo C 2.0, the screen displays:
── ─
File edit run compile project options debug break/watch
┌ ── ─ Edit ── ─ begin
│ Line 1 col 1 insert indent tab file unindent C: noname. c │







│ ── ─ │


└ ── ─
F1-Help F5-Zoom F6-Switch F7-Trace F8-Step F9-Make
── ─
The top line is the main menu of Turbo C 2.0, the middle window is the editing area, and the next is the information window.
The bottom line is the reference line. These four windows constitute the Turbo C 2.0 main screen, subsequent programming,
Compilation, debugging, and running will all be performed on the home screen. The following describes the content of the main menu in detail.

1 Main Menu

The Main Menu displays the following content on the top of the Turbo C 2.0 main screen:
File edit run compile project options debug break/watch
All items except edit have sub-menus. You only need to use ALT to add the first letter of an item (that is, big writing ).
To enter the sub-menu of the item.
(1) file menu
Press Alt + F to go To the File menu, which includes the following:
. Load (load)
Load a file and select a list using a DOS-like wildcard (for example, *. C. You can also mount other
For a file with the extension, you only need to provide the file name (or only the path. The key of this item is F3, that is
Press F3 in the menu to enter the item, instead of entering the File menu and then selecting this item.
. Pick (select)
Columns the eight files in the last loading and editing window into a table for the user to choose from. Select and load the program
Edit the area and place the cursor in the Last modified area. Its hot health for Alt-F3.
. New (new file)
This indicates that the file is new. The default file name is noname. C. You can change the name when saving the disk.
. Save (save disk)
Store files in the editing area. If the file name is noname. C, you will be asked whether to change the file name.
The hot key is F2.
. Write to (storage)
You can give a file name to save the files in the editing area to the disk. If the file already exists, ask if you want
Overwrite.
. Directory)
Displays the files in the directory and Directory, which can be selected by the user.
. Change Dir (Change directory)
Displays the current directory. You can change the displayed directory.
. OS shell (temporarily quit)
Temporarily exit Turbo C 2.0 to the DOS prompt. You can run the DOS command.
In Turbo C 2.0, enter exit in DOS state.
. Quit (Exit)
Exit Turbo C 2.0 and return to the DOS operating system. The hotkey is Alt + X.

Note:
The above items can be selected by moving the color bar with the light tag key, and then press enter to execute. The first of each item is also available.
Select uppercase letters. If you want to return to the main menu or return from its next menu list box, you can use the ESC key,
All menus in Turbo C 2.0 use this method, which is not described below.
(2) edit menu
Press Alt + e to enter the editing menu. If you press enter, the cursor appears in the editing window.
Edit the text.
The editing method is basically the same as WordStar. You can use the F1 key to obtain help information about the editing method.
The Edit-related function keys are as follows:
F1 obtains help information about the Turbo C 2.0 editing command.
F5 expands the editing window to the entire Screen
F6 switch between the editing window and the Information Window
F10 go from the editing window to the main menu
Edit command introduction:
Pageup front flip
Pagedn flip back
Home move the cursor to the beginning of the row
End move the cursor to the end of the row
CTRL + y Delete the row where the cursor is located
CTRL + T delete a word at the cursor
CTRL + kb set block start
CTRL + kk
CTRL + kv Block Movement
CTRL + KC copy
CTRL + Ky block Deletion
CTRL + kr Read File
CTRL + kW save file
CTRL + KP block file Printing
CTRL + F1 if the cursor is located at the Turbo C 2.0 library function, get help on this function
Information
CTRL + Q [find the matching character of the Turbo C 2.0 dual-line operator
CTRL + q] Find the pre-match of the Turbo C 2.0 dual-line operator

Note:
A. The dual-interface operators of Turbo C 2.0 include the following symbols:
Included characters {And}
Tip character <and>
Circle character (and)
Square brackets [and]
Annotator/* and */
Double quotation marks"
Single quote'
B. When editing files, Turbo C 2.0 also has the function of automatic indentation, that is, cursor positioning.
Alignment with the previous non-empty character. In the editing window, CTRL + ol is the control key for the automatic indent switch.
(3) Run menu
Press Alt + R to enter the run menu, which has the following items:
. Run)
Run the file name specified by the project/project name or the file in the current editing area. If
If the source code after the secondary compilation is not modified, it runs directly to the next breakpoint (if there is no breakpoint, it runs until the end ).
Otherwise, the system runs only after compilation and connection. The key is Ctrl + F9.
. Program reset (Program Restart)
Stop the current debugging and release the space allocated to the program. The hot key is Ctrl + F2.
. Go to cursor (run to cursor)
When debugging a program, select this option to run the program to the row where the cursor is located. The row where the cursor is located must be
An executable statement. Otherwise, an error is returned. The hot key is F4.
. Trace)
When a sub-function called by another user is executed, if the trace into item is used
It traces the execution of this subfunction internally, and its hotkey is F7.
. Step over (single-step execution)
Execute the next statement of the current function. Even if the user calls the function, the execution bar will not be tracked into the function.
Internal, the hot key is F8.
. User Screen)
Displays the results displayed on the screen when the program is running. The hot key is Alt + F5.

(4), compile (Compilation) menu
Press Alt + C to enter the compile menu, which has the following content:
. Compile to OBJ (compile and generate the target code)
Compile a C source file to generate the. OBJ target file, and display the generated file name. The hotkey is
Alt + F9.
. Make EXE file (generate the execution file)
This command generates a. EXE file and displays the generated. EXE file name. The. exe file name is
.
A. Name of the project file described by project/project name.
B. If there is no project file name, the source file is described by primary C file.
C. If neither of the above two items has a file name, it is the file name of the current window.
. Link EXE file (connect to generate the execution file)
Concatenate the current. OBJ file and the library file to generate the. exe file.
. Build all (create all files)
Recompile all files in the project and assemble and generate the. exe file. This command does not perform an out-of-date check
(The above commands need to be checked for expiration, that is, if the date and time of the source file in the current project and the target file
Files are the same or earlier, and the source files are not compiled ).
. Primary C file (Master C file)
After the master file is specified in this item, compile this item in future compilation if no project file name exists.
The main c file specified in. If any compilation error occurs, transfer the file to the editing window, regardless of the current window
Is it the main c file.
. Get Info (get the current path, source file name, source file byte size, number of errors in compilation)
Project, available space, and other information.
(5) Project menu
Press Alt + P to enter the project menu, which includes the following:
. Project Name (project name)
The project name has an extension of. prj, including the name of the file to be compiled and connected. For example, there is a process
It consists of file1.c, file2.c, and file3.c in sequence. These 3 files must be compiled and compiled
Run the following command to create a file. prj project file:
File1.c
File2.c
File3.c
Put file. prj into the project name, and the project file will be automatically compiled later.
The three specified source files are compiled respectively. Then connect to the file.exe file.
If some of these files have been compiled into. OBJ files, but have not been modified, you can directly write. OBJ extension.
Exhibition name. At this time, the connection will not be compiled but will only be performed.
Example: file1.obj
File2.c
File3.c
File1.c will not be compiled and directly connected.
Note:

When each file in the project file has no extension, it is treated as the source file. In addition
It can be a library file, but the extension. Lib must be specified.
. Break make on (abort compilation)
Whether or not there is a warining (warning), errors (error), and fatal errors (fatal error
By mistake) or before Link (connection.
. Auto dependencies (automatic dependency)
When the switch is set to on, the date and time of the source file and the corresponding. OBJ file will be checked during compilation; otherwise
Row check.
. Clear Project (clear project files)
Clear the project file name in Project/project name.
. Remove messages (delete information)
Clear the error information from the Information Window.
(6), options (Select menu)
Press Alt + O to enter the Options menu, which should be used with caution for beginners.
. Compiler (compiler)
This option has many sub-menus, allowing users to choose hardware configuration, storage model, debugging technology,
Code optimization, dialog information control, and macro definition. The sub-menus are as follows:
Model
There are six different modes: Tiny, small, medium, compact, large, and huge, which can be selected by the same user.
Select.
Define
Open a macro definition box and enter the macro definition for the same user. Multiple definitions can be the same as semicolons, and values can be equal.
Code Generation
It has many other options, which tell the compiler what target code is generated.
Calling convention can be used to pass parameters in C or Pascal mode.
The instruction set can be set to 8088/8086 or 80186/80286.
Floating point can be a floating point simulation, a mathematical coprocessor, or a non-floating point operation.
The default char type specifies the char type.
Alignonent specifies the address alignment principle.
Merge duplicate strings is used for optimization to combine repeated strings.
Standard stack frame generates a standard stack structure.
Test Stack Overflow generates code to detect stack overflow when a program is running.
Line number is placed in the. OBJ file for debugging.
OBJ debug information generates debugging information in the. OBJ file.
Optimization
Optimize for selects whether to small programs or optimize program speed
Processing.
Use register variable to select whether to allow use of register variables.
Register optimization use register variables whenever possible to reduce excessive number of operations
.
Jump optimization removes unnecessary jump and adjustment cycles and switch statements
To compress the code.
Source
Indentifier Length indicates the number of valid characters of the identifier. The default value is 32.
Whether nested comments are allowed.
Whether ANSI keywords only allows only ANSI keywords or Turbo C
2.0 keywords
Error
Number of errors after error stop: stops compilation. The default value is 25.
The number of warning errors in warning stop after. The default value is 100.
Display warning
Portability warning portability warning error.
ANSI violations infringes the ANSI keyword warning error.
Common error common warning errors.
Less common error is a rare warning error.
Names is used to change segments, groups, and classes.
(Class) name. The default value is code, data, and BSS.

. Linker (connector)
This menu sets the connection options, which have the following content:
Map File menu: Select whether to generate a. Map File.
Whether the initialize segments are not initialized during connection.
Whether devault libraries searches for the target file generated by other compilation programs
Find the default library.
Whether the graphics library connects to functions in the graphics library.
Warn duplicate symbols generates a warning when there are repeated symbols.
Whether stack warinig generates no warning information for the connected program.
Whether case-sensitive links distinguish between large and small writing.

. Environment (Environment)
This menu specifies whether to enable automatic storage of certain files, tabulation keys, and screen size settings.
Message tracking
Current file tracks file errors in the editing window.
All files tracks all file errors.
Off.
Whether to clear the information in the message window before compiling the keep message.
When config auto save is selected on, before running, shell, or exiting the integrated development environment,
If the configuration of Turbo C 2.0 is modified
Will be saved to the configuration file. If you select off, It is not saved.
Whether edit auto save automatically stores the edited source file before run or shell.
Whether the backup file generates a backup file (. Bak file) when the source file is stored on the disk ).
Tab size: Specifies the tabulation key size. The default value is 8.
Zoomed windows zooms the current active window to the screen, and its hot key is F5.
Screen Size: set the screen text size.

. Directories (PATH)
Specify the path of the files required for compilation and connection:
Include directories contains the file path. Separate multiple subdirectories.
Directory of the library directories. Separate multiple subdirectories.
Output directory of the directoried output file (. OBJ,. EXE,. map file.
The directory where Turbo C directoried Turbo C is located.
Pick file name defines the loaded pick file name.
Pick file.

. Arguments (command line parameters)
Allows you to use command line parameters.

. Save options (storage configuration)
Save all Selected Compilation, connection, debugging, and projects to the configuration file. The default configuration file is
Tcconfig. tc.

. Retrive options
Load a configuration file to TC. TC will use the selected items of this file.
(7) Debug menu
Press Alt + D to select the Debug menu, which is mainly used for error detection. It includes the following content:
Evaluate
The expression to calculate the result.
Result shows the calculation result of the expression.
New value is assigned to the new value.
Call Stack is inaccessible. In Turbo C debuger
Check the stack status.
The find function is used to display the specified function when running the Turbo C debugger.
Refresh display can be restored if the editing window is accidentally overwritten by the user window
Edit the content of the window.

(8), break/Watch (breakpoint and monitoring expression)
Press Alt + B to enter the break/watch menu, which has the following content:
Add watch inserts a monitoring expression into the monitoring window.
Delete watch deletes the current monitoring expression from the inner window.
Edit watch: edit a monitoring expression in the monitoring window.
Remove all watches delete all monitoring expressions from the monitoring window.
Toggle breakpoint sets or clears the breakpoint for the row where the cursor is located.
Clear all breakpoints clear all breakpoints.
View next breakpoint: move the cursor to the next breakpoint.

Six Turbo C 2.0 configuration file

The so-called configuration file is a file containing information about Turbo C 2.0, which contains the compilation and connection options.
Information such as selection and path.
You can use the following method to configure Turbo C 2.0:
1. Create a custom configuration file
You can select the options/save Options command from the Options menu to integrate the current development environment
All configurations are stored in a configuration file named by the user. When starting TC next time, you only need to type in DOS:
TC/C <configuration file name named by the user>
The content in this configuration file will be used as the choice of Turbo C 2.0.
2. If options/environment/config auto save is set to on, exit the integrated development environment.
The current settings are automatically stored in the tcconfig. TC configuration file of Turbo C 2.0. Turbo C in
The configuration file is automatically searched for at startup.
3. Use tcinst to configure Turbo C and save the result to TC. EXE. Turbo C starts
If the configuration file is not found, take the default value in TC. EXE.

/*************************************** **************************************** **************************************** ******************/

Command Line compilation refers to calling the tcc.exe program of trubo cin dos to complete the source program of Turbo C.
Sequential compilation and connection work. When you select to compile the assembly program file with the suffix *. ASM, TCC also calls
Tasm can be used to compile files suffixed with. ASM. This method is suitable for the combination of C Programs and assembly languages.
Programming compilation connection. This method must also be used to compile the connection when the C program embeds Assembly commands.

The command line compilation format is:
TCC [option 1 option 2...] File Name 1 file name 2...
The options are the options used to connect to the files provided later. The optional common options are as follows:
Note: Each option is prefixed with "-" And case sensitive.
File name refers to the source file. C or target file. OBJ or library file. Lib
If you do not specify to compile but not connect, TCC will complete the compilation and connection steps, and only perform the form for the. Lib library.
Standard database users do not need to connect.
For example:
TCC-IB: \ include-LB: \ Lib-Etest start. C body. OBJ ..
When you execute this command, the start. C source file and the target file body. OBJ and
File Without a suffix), respectively compile (do not compile the body. OBJ file), and then generate a connection named Test
Execution file test.exe (given by-test ).

-IB: \ include indicates that the path of the file to be included is B: \ include.
-IB: \ Lib indicates that the path of the library file is B: \ Lib.

For example:

TCC-MS-efile-LC: \ TC \ Lib file1 file2.obj graphics. Lib
-Ms indicates selecting the small memory mode for compilation. It is also the default compilation mode of Turbo C.
And then connect to file2.obj and graphics.libto generate the executable file of file.exe.
The path of the graphcis. Lib library is c: \ TC \ Lib, which means to search for it in the C: \ TC \ lib directory.
Graphics. Lib file.
For mixed programming, if the assembly program s3.asm already exists, its command line can be written
Tcc ic: \ TC \ include-LC: \ TC \ Lib-mm S1 S2 s3.asm mylib. Lib
Indicates to compile the source files s1.c and s2.c in the middle mode (-mm), call tasm to compile s3.asm, and then connect
Generate the executable file s1.exe. during compilation, go to the C: \ TC \ include directory to find the inclusion file, go
C: \ TC \ lib directory to find the library file mylib. Lib.

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.