[c] compiling the execution program at the command line

Source: Internet
Author: User
Tags sublime text

-----------------------------------------------------------------------------------------

1. Before writing the C language on Mac and Linux, first look to see if the compiler is installed:

Enter GCC under the terminal to check the carriage return, if installed, will prompt Clang:error:no input files (no input file);

If it is not installed, install the Xcode or GCC compiler under the prompts under the Mac, and directly yum-y the install GCC gcc-c++ under CentOS (-y means you will be selected automatically)

[email protected] Black eyed poet <www.chenwei.ws>----------------------------

2. Now start writing the code happily:

Use Command+r on your new project file in Xcode to compile and run your C code directly.

Under the Mac terminal, using the artifact vim, such as Vim test.c, it will not help you create a new test.c, after writing the C code you need to Command+s save, and then: wq! exit, use the command gcc TEST.c compile, do not specify the compiled file name, the compilation file name will be a.out, run it to use./a.out

Under Linux, also use vim, input vim test.c when the new test.c file in the current directory, write the C code directly: wq! save exit, use GCC test.c compile, run the compiled file./a.out

Sublime text is a worthwhile text editor, if you install the environment, use CMD+B to compile the code, shift+cmd+b run, but Sublime can only run a program, if you need to run an input program, you must leave Sublime to enter the terminal.

  

In the Windows environment, the C + + integrated development Environment (IDE) recommends dev-c++, which is not covered here: Http://sourceforge.net/projects/orwelldevcpp/?source=directory.

3. DEMO:

" stdio.h " int Main () {  printf ("nihao,shijie! \ n"); Nihao, Shijie

printf ("12+12=%d", 12+12); 12+12=24
return 0 ; }

[c] compiling the execution program at the command line

Related Article

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.