TCC (tiny C compiler) Introduction

Source: Internet
Author: User

TCC is an ultra-small, ultra-fast Standard C language compiler. She can download it from here (http://bellard.org/tcc/); note, to download the http://download.savannah.nongnu.org/releases/tinycc/tcc-0.9.25-win32-bin.zip

Like notepad2, TCC is also free! (Cool again !!!)

After the download, decompress the package to a folder:

All the compilation systems we need are in the TCC folder.

The use of TCC is as follows: http://bellard.org/tcc/tcc-doc.html English? Of course, I already told you that you want to learn English well.

Here is an example of TCC usage:

First, I have a. c source file.

Write with notepad2Source code, Save:

 

Next, we use TCC to test ourProgramWhether the design is correct.

First, we need to add the TCC directory to the path environment variable of the system. (I don't know what an environment variable is. please google it yourself .) The procedure is as follows:

Right-click "my computer" = "" property "=" "advanced" = "" environment variable "=" (double-click the system variable) "path"

Add an image like; D: \ temp \ TCC to specify the location of TCC. Note: Previously, it was used to separate all locations, and there must be no less.Next, just click "OK.

Next, I will introduce two methods to use TCC. These two methods are actually one thing, but I prefer the second one.

First: Compile the link SourceCodeTo generate an executable file.

Open the command line prompt: "Start" = "run" (Enter cmd) = "OK"

Go to the directory where the. C source code is located and compile the link source code:

Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C: \ Documents ents and Settings \ Administrator>Cd d: \ Temp

C: \ Documents ents and Settings \ Administrator>D:

D: \ Temp>

The command used to compile the link is:TCC source code file name(Do not omit the. c file name. TCC must be followed by spaces.); Example:

D: \ Temp>TCC test. c
Test. C:5: Missing terminating "Character

In this case, an error occurs in row 5th of the test. c file. The error is caused by the missing "character indicating termination ". Therefore, we fixed our code in notepad2 and saved it as follows:

Return to the command line prompt again (under the interface that does not fall in the dark) and compile the link:

D: \ Temp>TCC test. c

D: \ Temp>

Nothing dynamic?No message. It is good news!This is the code of conduct for the computer world. Check whether your folder contains more of this:

OK ,double-click the executable file of this .exe and check the running result. Oh? Is there a flash on the screen? What should I do? You can directly input test.exe and press enter to execute this file:

D: \ Temp>Test.exe
Haha
D: \ Temp>

You see, it's done!

======================================

A very important secret: At the command line prompt, we often need to repeatedly enter many identical commands. It is annoying to execute these commands every time. In fact, you don't have to do this. You only need to run the command once. The next time you use this command again, you don't have to type any more.Press the "up" arrow direction key on the keyboard...... Look! Did the command just come out? So cool!

======================================

The above is the first method to use TCC. There is also a second usage:

Sometimes, I will not allow tccgenerate the executable file of .exe, and then run it again. I only need to use

TCC-run source code file name

You can directly let TCC skip the compilation link step and directly run our program (of course, the premise is that your code has no syntax errors); the following:

D: \ Temp>TCC-run test. c
Haha
D: \ Temp>

======================================

Evaluate the advantages and disadvantages of TCC:

Advantages:

    1. Small and exquisite. Plug in the USB flash drive and use it at any time. You can use it at any time without installation.
    2. Supports the latest international C language standards. Programs that can run in TCC can run in other compiling environments.
    3. Fast! TCC runs fast!

Disadvantages:

    1. There is no breakpoint or one-step execution tracking system. In the face of complicated program logic, it is difficult to debug the program's runtime logic error.

Conclusion: TCC is cool. I like her very much!

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.