Compile and run C code under MAC OS x system

Source: Internet
Author: User

1. Using the compiler to convert the code in the source file into binary code, this process is called compiling.

Switch the work path of the terminal to the path where the source file resides.

Cc-c the name of the source file. Example: Cc-c main.c

If there is no accident, an. o file is generated under the current working path, which is called the target file.

The destination file stores the binary instructions that correspond to the code in the. c file.

2. The target file only stores the binary instructions that correspond to the code in the. c file.

If a program wants to give the CPU execution, the light does not work.

You must also add some startup code for this target file. The process of adding a startup code is called a link.

CC target file name. Example: CC MAIN.O

If everything is normal, a a.out file is generated. This file is the final program that can be executed.

3. Execute the A.OUT program and you will see the results of the program execution.

./a.out

Compile and run C code under MAC OS x system

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.