What is a console that can be executed in programming
- Setting up directories using the text console
- Compile a program file in the terminal window
- Run the self-written program
All you need to learn is a simple text editor and the GCC compiler to get started. If you haven't installed these programs yet, click on the respective link. Follow the instructions for the GCC compiler, test it as described there and select a text editor.
If you have already installed a GCC compiler, please carry out the following steps to test it. Otherwise, create a directory as described, copy the source text into it and find out what it means in the next lesson.
The first step in learning to program is figuring out how and if you can compile anything at all. For this we go to the console. Under Linux we start a terminal, under MacOS the application 'Terminal' can be found under Utilities and under Windows, depending on the version, the terminal can be found under 'Start → Windows System → Command Prompt' or 'Start → All Programs → Accessories → Command Prompt' . If you want it a little faster under Windows, right-click on 'Start' and select 'Run' and enter “cmd” as the command in the dialog box that opens.
Setting up directories using the text console
In any case, we are now in the user directory with the console. Only under Windows do we first switch to the desktop so that we can get to the folder more easily:cd desktop
The following commands apply equally to Linux, Mac and Windows: Now we create a directory with the name "c" in which we will work in the future.mkdir c
Now we go to this directory with the command “cd”, create a directory “hworld” with “mkdir” and change to this too.cd c mkdir hworld cd hworld
Entering a program
This is where we write our first program. To do this, we start the editor of choice and enter the following program text:#include
Compile a program file in the terminal window
We save this in the “hworld” directory under the name “hworld.c”. After saving, we go back to the console window and call the compiler as follows:gcc hworld.c
The compiler should not provide any output. If you made a mistake, you will receive corresponding error messages. So if you get output from the compiler, try to identify what is incorrectly written off. If you get stuck, please report - including the error messages - in the forum. There you will be helped.
If no messages were displayed, you have apparently successfully compiled your first program.
On Linux and Macintosh, you can use the ls command to see what is in the directory. In Windows you use the command "dir".
Run the self-written program
On Linux and Mac you will now find a file "a.out", on Windows it is called "a.exe". This is the generated program. You can run it by typing "./a.out" on Mac and Linux and "a.exe" on Windows in the terminal window and pressing the Enter key.
This should appear on the consoleHello proggen.org
You have now created directories in which you can store the future programs of this tutorial. You can also create and compile a single program file and run the executable program in the terminal window.
You don't need to understand the compiled source code just yet; we'll continue with that in the next lesson.
- When are the Beatles considered classic
- For how many years is bcom honored
- What is the difference between cotton and hemp
- Taiwanese Mandarin What exactly means in Taiwan
- What is PPSC
- Is Squadhelp com fake
- Where do I breathe when I speak?
- Is it better to call Saul worth seeing
- What does the Serbian word prcija mean
- What is meant by offset spatial divergence?
- What are your film recommendations for 2018
- Would you buy a Nissan GTR again
- How should we play the piano
- What is the Chemical Structure of Accutane
- How do I choose a TV
- Do braces look normal after teenage years
- Who would win Beerus against Spider Man?
- What's the best card game app
- What is the easiest card game to learn
- Is second-hand smoking dangerous?
- What is who a TDC
- What is the best burger joint in Mumbai
- A root canal is considered an oral surgery
- Are there giant marine animals yet to be discovered