H

How to make a computer program with "Hello world!"

(ただ英語の記事を書くと伸びるのかっていうのの検証とかっこいいから書くだけ(英弱だけど))

Please do it with sudo

When we use the linux like centos, we face a problem that can not use GUI. It means can not use editor like Visual studio code, Atom, and so on. I describe how to make computer program with "Hello world" for them. In this article, I use C language.

When you start to write, please push 'I' key and transfer INSERT mode. And please push 'ESC' and run that command ':wq' on you finished writing your code.

The first step for learning is installing only GCC, or GNU Complier Collection. In many Linuxs installed Vim, or other text editor. So we have not install editor such as Vim.

Programing

In C code, As you know, the first element for writing is

#include <stdio.h>

Second step is putting sign of function. We have to put this

int main(void){}

in any case. And I recommend writing "void" as argument of function main(). I will write more code in this function.
Third step is writing as this

int main(void){
  puts("Hello world!");
  return (0);
}

You can write for your code with Copy & Paste.

Compile

If you finished writing program, You have to compile your code. It is easy. You write as this

gcc test.exe -o [file name]

After you run this command, GCC makes a new program we can run.

And, you run this command

./test.exe

You will see "Hello world!"


Thank you for reading. If this article has problem, please tell me by using Twitter, the contact form, or writing the comment.