Set up a compilation environment where TCC can be called anywhere

Source: Internet
Author: User

TCC's dapper, fast-compiling, and unique direct-running C-code functionality allows TCC to become an excellent compiler across the Linux,windows platform.

The author is still in the study C (ANSI C/iso C) stage, in order to strengthen the ability of handwriting code, so there is this compiler using the technique.

Here is a cumbersome sentence:

Handwriting and compile the link code, for most people this is not conceivable, I use VC, the last thing to use VS, it is difficult for many people to imagine,

This is done in order to be able to expect to compile a short or OS-free C code without relying on a higher version of the C runtime, such as vcruntime7,8,9 or later versions.

Also expect to be able to write some code in bad environment.

Save the following batch to Tcc.bat saved in the root directory of the TCC installation directory, such as the author installed in the D:\DEVELOP\TCC directory, the following code is saved to D:\DEVELOP\TCC, the final file absolute path

D:\develop\tcc\tcc.bat

@echo offEchostart----------------------TCC----------------------compile information. exe%1-vv-benchEcho----------------------preprocessing begins------------------------TCC. exe%1- eEcho----------------------preprocessing End------------------------Echo----------------------compile information ends----------------------EchoThe directory where the Build program is compiled%~DP1EchoThe results of the program run as follows:Echo--------------------------------------------------------%~n1Echo--------------------------------------------------------

Then add it to the system environment variable path

Methods: Right-click "My Computer"-"Properties", system variables, find the PATH variable, click "Edit", press the Home key, navigate to the beginning of the line, enter D:\DEVELOP\TCC;

The following is the test code and the use

//print.h #define  PR printf#define nl "\ n"#define D "%d"#define D1 d nl#define D2 d d NL#define D3 D NL
// file1.c " print.h " Main () {    int123;    PR (d1,a);    PR (d2,a,b);    PR (d3,a,b,c);}

Set up a compilation environment where TCC can be called anywhere

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.