linux install GCC and simply compile execute "hello world" print

Reprinted from:

https://www.cnblogs.com/yadongliang/p/6100003.html


1. Installation

yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake
yum -y install wget httpd-tools vim

 1. Just use gcc as a C language compiler and g++ as a C++ language compiler. (Knowing)

2.wget is a free tool that automatically downloads files from the Internet. After the user exits the system, it can continue to execute in the background until the download task is completed. (Baidu Encyclopedia)


 2. Test (view version information, compile Helloworld)

a. View gcc version information

gcc --version

b. Write Helloworld

Create a file named ctest.c

touch ctest.c

edit the file

copy code
#include <stdio.h>

intmain ()
{
printf("hello world!\n");
return 0;
}
copy code

 Compile gcc ctest.c

You can see that the a.out file is generated

execute a.out

./a.out

output result

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324374324&siteId=291194637